// <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>
    /// It contains all the registration/creation time properties of a
    /// simulator session.
    /// </summary>
    public partial class SimulatorInterface
    {
        /// <summary>
        /// Initializes a new instance of the SimulatorInterface class.
        /// </summary>
        public SimulatorInterface()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the SimulatorInterface class.
        /// </summary>
        /// <param name="name">Name of the simulator session.</param>
        /// <param name="timeout">This is the max time in seconds, within which
        /// simulator need to send advance request, else it will be timed out
        /// and unregistered from Bonsai platform.
        /// Set it to (SimulatorComputeTime + RTT network latency + few
        /// seconds)
        /// Default is 60s</param>
        /// <param name="capabilities">Additional Capabilities for the
        /// session.</param>
        /// <param name="simulatorContext">Opaque string to the sim authors.
        /// It's used to connect simulator sessions to right brain.false
        /// For hosted sims, we automatically take care of setting the right
        /// environment variable for this.
        /// For Local sims, set it to empty string, and use Bonsai CLI's,
        /// `bonsai connect` command.</param>
        /// <param name="description">Schema descriptions of the simulator.
        /// Contains State, Action and Config schemas.</param>
        public SimulatorInterface(string name, double? timeout = default(double?), object capabilities = default(object), string simulatorContext = default(string), object description = default(object))
        {
            Name = name;
            Timeout = timeout;
            Capabilities = capabilities;
            SimulatorContext = simulatorContext;
            Description = description;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets name of the simulator session.
        /// </summary>
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets this is the max time in seconds, within which
        /// simulator need to send advance request, else it will be timed out
        /// and unregistered from Bonsai platform.
        /// Set it to (SimulatorComputeTime + RTT network latency + few
        /// seconds)
        /// Default is 60s
        /// </summary>
        [JsonProperty(PropertyName = "timeout")]
        public double? Timeout { get; set; }

        /// <summary>
        /// Gets or sets additional Capabilities for the session.
        /// </summary>
        [JsonProperty(PropertyName = "capabilities")]
        public object Capabilities { get; set; }

        /// <summary>
        /// Gets or sets opaque string to the sim authors. It's used to connect
        /// simulator sessions to right brain.false
        /// For hosted sims, we automatically take care of setting the right
        /// environment variable for this.
        /// For Local sims, set it to empty string, and use Bonsai CLI's,
        /// `bonsai connect` command.
        /// </summary>
        [JsonProperty(PropertyName = "simulatorContext")]
        public string SimulatorContext { get; set; }

        /// <summary>
        /// Gets or sets schema descriptions of the simulator. Contains State,
        /// Action and Config schemas.
        /// </summary>
        [JsonProperty(PropertyName = "description")]
        public object Description { get; set; }

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