// <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>
    /// CertificateSigningRequestCondition describes a condition of a
    /// CertificateSigningRequest object
    /// </summary>
    public partial class V1CertificateSigningRequestCondition
    {
        /// <summary>
        /// Initializes a new instance of the
        /// V1CertificateSigningRequestCondition class.
        /// </summary>
        public V1CertificateSigningRequestCondition()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the
        /// V1CertificateSigningRequestCondition class.
        /// </summary>
        /// <param name="status">status of the condition, one of True, False,
        /// Unknown. Approved, Denied, and Failed conditions may not be "False"
        /// or "Unknown".</param>
        /// <param name="type">type of the condition. Known conditions are
        /// "Approved", "Denied", and "Failed".
        ///
        /// An "Approved" condition is added via the /approval subresource,
        /// indicating the request was approved and should be issued by the
        /// signer.
        ///
        /// A "Denied" condition is added via the /approval subresource,
        /// indicating the request was denied and should not be issued by the
        /// signer.
        ///
        /// A "Failed" condition is added via the /status subresource,
        /// indicating the signer failed to issue the certificate.
        ///
        /// Approved and Denied conditions are mutually exclusive. Approved,
        /// Denied, and Failed conditions cannot be removed once added.
        ///
        /// Only one condition of a given type is allowed.</param>
        /// <param name="lastTransitionTime">lastTransitionTime is the time the
        /// condition last transitioned from one status to another. If unset,
        /// when a new condition type is added or an existing condition's
        /// status is changed, the server defaults this to the current
        /// time.</param>
        /// <param name="lastUpdateTime">lastUpdateTime is the time of the last
        /// update to this condition</param>
        /// <param name="message">message contains a human readable message
        /// with details about the request state</param>
        /// <param name="reason">reason indicates a brief reason for the
        /// request state</param>
        public V1CertificateSigningRequestCondition(string status, string type, System.DateTime? lastTransitionTime = default(System.DateTime?), System.DateTime? lastUpdateTime = default(System.DateTime?), string message = default(string), string reason = default(string))
        {
            LastTransitionTime = lastTransitionTime;
            LastUpdateTime = lastUpdateTime;
            Message = message;
            Reason = reason;
            Status = status;
            Type = type;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets lastTransitionTime is the time the condition last
        /// transitioned from one status to another. If unset, when a new
        /// condition type is added or an existing condition's status is
        /// changed, the server defaults this to the current time.
        /// </summary>
        [JsonProperty(PropertyName = "lastTransitionTime")]
        public System.DateTime? LastTransitionTime { get; set; }

        /// <summary>
        /// Gets or sets lastUpdateTime is the time of the last update to this
        /// condition
        /// </summary>
        [JsonProperty(PropertyName = "lastUpdateTime")]
        public System.DateTime? LastUpdateTime { get; set; }

        /// <summary>
        /// Gets or sets message contains a human readable message with details
        /// about the request state
        /// </summary>
        [JsonProperty(PropertyName = "message")]
        public string Message { get; set; }

        /// <summary>
        /// Gets or sets reason indicates a brief reason for the request state
        /// </summary>
        [JsonProperty(PropertyName = "reason")]
        public string Reason { get; set; }

        /// <summary>
        /// Gets or sets status of the condition, one of True, False, Unknown.
        /// Approved, Denied, and Failed conditions may not be "False" or
        /// "Unknown".
        /// </summary>
        [JsonProperty(PropertyName = "status")]
        public string Status { get; set; }

        /// <summary>
        /// Gets or sets type of the condition. Known conditions are
        /// "Approved", "Denied", and "Failed".
        ///
        /// An "Approved" condition is added via the /approval subresource,
        /// indicating the request was approved and should be issued by the
        /// signer.
        ///
        /// A "Denied" condition is added via the /approval subresource,
        /// indicating the request was denied and should not be issued by the
        /// signer.
        ///
        /// A "Failed" condition is added via the /status subresource,
        /// indicating the signer failed to issue the certificate.
        ///
        /// Approved and Denied conditions are mutually exclusive. Approved,
        /// Denied, and Failed conditions cannot be removed once added.
        ///
        /// Only one condition of a given type is allowed.
        /// </summary>
        [JsonProperty(PropertyName = "type")]
        public string Type { get; set; }

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