using System.Collections.Generic;
using System.ComponentModel;
using GitHub.DistributedTask.Pipelines.Validation;

namespace GitHub.DistributedTask.Pipelines
{
    [EditorBrowsable(EditorBrowsableState.Never)]
    public class PipelineBuildResult
    {
        public PipelineBuildResult(
            PipelineEnvironment environment, 
            PipelineProcess process,
            ValidationResult result)
        {
            this.Environment = environment;
            this.Process = process;
            m_validationResult = result;
        }

        /// <summary>
        /// Gets the environment which was generated by the builder.
        /// </summary>
        public PipelineEnvironment Environment
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the process which was generated by the builder.
        /// </summary>
        public PipelineProcess Process
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the list of errors which occurred while building the pipeline.
        /// </summary>
        public IList<PipelineValidationError> Errors
        {
            get
            {
                return m_validationResult.Errors;
            }
        }

        /// <summary>
        /// Gets the set of all resources which are referenced by the pipeline. 
        /// </summary>
        public PipelineResources ReferencedResources
        {
            get
            {
                return m_validationResult.ReferencedResources;
            }
        }

        /// <summary>
        /// Gets the set of unauthorized resources, if any, which are referenced by the pipeline.
        /// </summary>
        public PipelineResources UnauthorizedResources
        {
            get
            {
                return m_validationResult.UnauthorizedResources;
            }
        }

        private readonly ValidationResult m_validationResult;
    }
}
