// <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.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// CustomResourceDefinitionStatus indicates the state of the
    /// CustomResourceDefinition
    /// </summary>
    public partial class V1beta1CustomResourceDefinitionStatus
    {
        /// <summary>
        /// Initializes a new instance of the
        /// V1beta1CustomResourceDefinitionStatus class.
        /// </summary>
        public V1beta1CustomResourceDefinitionStatus()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the
        /// V1beta1CustomResourceDefinitionStatus class.
        /// </summary>
        /// <param name="acceptedNames">AcceptedNames are the names that are
        /// actually being used to serve discovery They may be different than
        /// the names in spec.</param>
        /// <param name="conditions">Conditions indicate state for particular
        /// aspects of a CustomResourceDefinition</param>
        /// <param name="storedVersions">StoredVersions are all versions of
        /// CustomResources that were ever persisted. Tracking these versions
        /// allows a migration path for stored versions in etcd. The field is
        /// mutable so the migration controller can first finish a migration to
        /// another version (i.e. that no old objects are left in the storage),
        /// and then remove the rest of the versions from this list. None of
        /// the versions in this list can be removed from the spec.Versions
        /// field.</param>
        public V1beta1CustomResourceDefinitionStatus(V1beta1CustomResourceDefinitionNames acceptedNames, IList<V1beta1CustomResourceDefinitionCondition> conditions, IList<string> storedVersions)
        {
            AcceptedNames = acceptedNames;
            Conditions = conditions;
            StoredVersions = storedVersions;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets acceptedNames are the names that are actually being
        /// used to serve discovery They may be different than the names in
        /// spec.
        /// </summary>
        [JsonProperty(PropertyName = "acceptedNames")]
        public V1beta1CustomResourceDefinitionNames AcceptedNames { get; set; }

        /// <summary>
        /// Gets or sets conditions indicate state for particular aspects of a
        /// CustomResourceDefinition
        /// </summary>
        [JsonProperty(PropertyName = "conditions")]
        public IList<V1beta1CustomResourceDefinitionCondition> Conditions { get; set; }

        /// <summary>
        /// Gets or sets storedVersions are all versions of CustomResources
        /// that were ever persisted. Tracking these versions allows a
        /// migration path for stored versions in etcd. The field is mutable so
        /// the migration controller can first finish a migration to another
        /// version (i.e. that no old objects are left in the storage), and
        /// then remove the rest of the versions from this list. None of the
        /// versions in this list can be removed from the spec.Versions field.
        /// </summary>
        [JsonProperty(PropertyName = "storedVersions")]
        public IList<string> StoredVersions { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (AcceptedNames == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "AcceptedNames");
            }
            if (Conditions == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "Conditions");
            }
            if (StoredVersions == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "StoredVersions");
            }
            if (AcceptedNames != null)
            {
                AcceptedNames.Validate();
            }
            if (Conditions != null)
            {
                foreach (var element in Conditions)
                {
                    if (element != null)
                    {
                        element.Validate();
                    }
                }
            }
        }
    }
}
