using System;
using System.Collections.Generic;


namespace AIRuntime.Runtime.Agents
{
    /// <summary>
    /// Runtime preferences for an agent.
    /// Does not execute the agent.
    /// </summary>
    public sealed class AgentProfile
    {
        private readonly List<string> _preferredProviders =
            new List<string>();


        public AgentProfile(
            string agentId)
        {
            if (string.IsNullOrWhiteSpace(agentId))
            {
                throw new ArgumentException(
                    "Agent id cannot be empty.",
                    nameof(agentId));
            }


            AgentId =
                agentId;
        }


        public string AgentId
        {
            get;
        }


        /// <summary>
        /// Provider priority preference.
        /// Example:
        /// Ollama
        /// NVIDIA
        /// OpenRouter
        /// </summary>
        public IReadOnlyList<string> PreferredProviders
        {
            get
            {
                return _preferredProviders;
            }
        }


        public double Temperature
        {
            get;
            set;
        } =
            0.2;


        public int MaxTokens
        {
            get;
            set;
        }



        public void AddPreferredProvider(
            string providerName)
        {
            if (string.IsNullOrWhiteSpace(providerName))
            {
                throw new ArgumentException(
                    "Provider name cannot be empty.",
                    nameof(providerName));
            }


            if (!_preferredProviders.Contains(providerName))
            {
                _preferredProviders.Add(
                    providerName);
            }
        }


        public void RemovePreferredProvider(
            string providerName)
        {
            if (string.IsNullOrWhiteSpace(providerName))
                return;


            _preferredProviders.Remove(
                providerName);
        }
    }
}
