using System;
using System.Collections.Generic;


namespace AIRuntime.Runtime.Agents.Runtime
{
    /// <summary>
    /// Immutable snapshot of an agent profile used during
    /// a single execution.
    ///
    /// Changes made to the original AgentProfile after this
    /// object is created do not affect the active execution.
    /// </summary>
    public sealed class AgentExecutionOptions
    {
        private readonly IReadOnlyList<string> _preferredProviders;


        public AgentExecutionOptions(
            AgentProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(
                    nameof(profile));
            }


            AgentId =
                profile.AgentId;


            Temperature =
                profile.Temperature;


            MaxTokens =
                profile.MaxTokens;


            _preferredProviders =
                new List<string>(
                        profile.PreferredProviders)
                    .AsReadOnly();
        }


        public string AgentId
        {
            get;
        }


        public double Temperature
        {
            get;
        }


        public int MaxTokens
        {
            get;
        }


        /// <summary>
        /// Preferred provider names in priority order.
        /// </summary>
        public IReadOnlyList<string> PreferredProviders
        {
            get
            {
                return _preferredProviders;
            }
        }


        public bool HasPreferredProviders
        {
            get
            {
                return _preferredProviders.Count > 0;
            }
        }
    }
}