using System;

using AIRuntime.Runtime.Agents;


namespace AIRuntime.Runtime.Agents.Runtime
{
    /// <summary>
    /// Represents a running instance of an agent definition.
    /// Stores runtime state, not agent configuration.
    /// </summary>
    public sealed class AgentSession
    {
        public AgentSession(
            AgentDefinition definition)
        {
            if (definition == null)
            {
                throw new ArgumentNullException(
                    nameof(definition));
            }


            Definition =
                definition;


            SessionId =
                Guid.NewGuid()
                    .ToString();
        }


        /// <summary>
        /// Agent configuration backing this session.
        /// </summary>
        public AgentDefinition Definition
        {
            get;
        }


        /// <summary>
        /// Unique runtime session identifier.
        /// </summary>
        public string SessionId
        {
            get;
        }


        /// <summary>
        /// Number of executions performed.
        /// </summary>
        public int ExecutionCount
        {
            get;
            private set;
        }


        public void RecordExecution()
        {
            ExecutionCount++;
        }
    }
}