// <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 k8s.Models
{
    using Microsoft.Rest;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// Subject matches the originator of a request, as identified by the
    /// request authentication system. There are three ways of matching an
    /// originator; by user, group, or service account.
    /// </summary>
    public partial class Flowcontrolv1beta1Subject
    {
        /// <summary>
        /// Initializes a new instance of the Flowcontrolv1beta1Subject class.
        /// </summary>
        public Flowcontrolv1beta1Subject()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the Flowcontrolv1beta1Subject class.
        /// </summary>
        /// <param name="kind">Required</param>
        public Flowcontrolv1beta1Subject(string kind, V1beta1GroupSubject group = default(V1beta1GroupSubject), V1beta1ServiceAccountSubject serviceAccount = default(V1beta1ServiceAccountSubject), V1beta1UserSubject user = default(V1beta1UserSubject))
        {
            Group = group;
            Kind = kind;
            ServiceAccount = serviceAccount;
            User = user;
            CustomInit();
        }

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

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "group")]
        public V1beta1GroupSubject Group { get; set; }

        /// <summary>
        /// Gets or sets required
        /// </summary>
        [JsonProperty(PropertyName = "kind")]
        public string Kind { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "serviceAccount")]
        public V1beta1ServiceAccountSubject ServiceAccount { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "user")]
        public V1beta1UserSubject User { get; set; }

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