<gh_stars>0// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Bonsai.SimulatorApi.Models
{
    using Microsoft.Rest;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// SimulatorSession model, having details of one active simulator session.
    /// When a simulator registers, it creates and starts active simulator
    /// session.
    /// When that simulator deregisters itself, it ends and removes its
    /// simulator session.
    /// If the Bonsai platform deregisters a simulator due to that simulator's
    /// "misbehavior,"
    /// that also ends and removes that simulator's session.
    /// </summary>
    public partial class SimulatorSessionResponse
    {
        /// <summary>
        /// Initializes a new instance of the SimulatorSessionResponse class.
        /// </summary>
        public SimulatorSessionResponse()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the SimulatorSessionResponse class.
        /// </summary>
        /// <param name="sessionId">Unique sessionId for this simulator
        /// session.</param>
        /// <param name="registrationTime">Time when this session was
        /// registered with Bonsai platform.</param>
        /// <param name="lastSeenTime">A recent time that this simulator
        /// communicated with the Bonsai platform.
        /// This value is updated at a regular interval, so it may not be the
        /// most recent communication time.</param>
        /// <param name="lastIteratedTime">A recent time that this simulator
        /// received an EpisodeStep from the Scholar.
        /// This value is updated at a regular interval, so it may not be the
        /// most recent communication time.</param>
        /// <param name="sessionStatus">Possible values include:
        /// 'Deregistered', 'Attachable', 'Attached', 'Detaching',
        /// 'Rejected'</param>
        /// <param name="iterationRate">Current IterationRate, 1 state-action
        /// loop is roughly maps to 1 iteration.</param>
        /// <param name="details">Additional Details for this session provided
        /// by Bonsai platform.</param>
        public SimulatorSessionResponse(string sessionId, System.DateTime registrationTime, System.DateTime lastSeenTime, System.DateTime lastIteratedTime, SimulatorSessionTypesStatus? sessionStatus = default(SimulatorSessionTypesStatus?), SimulatorSessionProgress sessionProgress = default(SimulatorSessionProgress), SimulatorInterface interfaceProperty = default(SimulatorInterface), SimulatorContext simulatorContext = default(SimulatorContext), double? iterationRate = default(double?), string details = default(string))
        {
            SessionId = sessionId;
            SessionStatus = sessionStatus;
            SessionProgress = sessionProgress;
            InterfaceProperty = interfaceProperty;
            SimulatorContext = simulatorContext;
            RegistrationTime = registrationTime;
            LastSeenTime = lastSeenTime;
            LastIteratedTime = lastIteratedTime;
            IterationRate = iterationRate;
            Details = details;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets unique sessionId for this simulator session.
        /// </summary>
        [JsonProperty(PropertyName = "sessionId")]
        public string SessionId { get; set; }

        /// <summary>
        /// Gets or sets possible values include: 'Deregistered', 'Attachable',
        /// 'Attached', 'Detaching', 'Rejected'
        /// </summary>
        [JsonProperty(PropertyName = "sessionStatus")]
        public SimulatorSessionTypesStatus? SessionStatus { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "sessionProgress")]
        public SimulatorSessionProgress SessionProgress { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "interface")]
        public SimulatorInterface InterfaceProperty { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "simulatorContext")]
        public SimulatorContext SimulatorContext { get; set; }

        /// <summary>
        /// Gets or sets time when this session was registered with Bonsai
        /// platform.
        /// </summary>
        [JsonProperty(PropertyName = "registrationTime")]
        public System.DateTime RegistrationTime { get; set; }

        /// <summary>
        /// Gets or sets a recent time that this simulator communicated with
        /// the Bonsai platform.
        /// This value is updated at a regular interval, so it may not be the
        /// most recent communication time.
        /// </summary>
        [JsonProperty(PropertyName = "lastSeenTime")]
        public System.DateTime LastSeenTime { get; set; }

        /// <summary>
        /// Gets or sets a recent time that this simulator received an
        /// EpisodeStep from the Scholar.
        /// This value is updated at a regular interval, so it may not be the
        /// most recent communication time.
        /// </summary>
        [JsonProperty(PropertyName = "lastIteratedTime")]
        public System.DateTime LastIteratedTime { get; set; }

        /// <summary>
        /// Gets or sets current IterationRate, 1 state-action loop is roughly
        /// maps to 1 iteration.
        /// </summary>
        [JsonProperty(PropertyName = "iterationRate")]
        public double? IterationRate { get; set; }

        /// <summary>
        /// Gets or sets additional Details for this session provided by Bonsai
        /// platform.
        /// </summary>
        [JsonProperty(PropertyName = "details")]
        public string Details { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (SessionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "SessionId");
            }
            if (InterfaceProperty != null)
            {
                InterfaceProperty.Validate();
            }
        }
    }
}
