// <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;

    public partial class V1beta1CustomResourceDefinitionVersion
    {
        /// <summary>
        /// Initializes a new instance of the
        /// V1beta1CustomResourceDefinitionVersion class.
        /// </summary>
        public V1beta1CustomResourceDefinitionVersion()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the
        /// V1beta1CustomResourceDefinitionVersion class.
        /// </summary>
        /// <param name="name">Name is the version name, e.g. “v1”, “v2beta1”,
        /// etc.</param>
        /// <param name="served">Served is a flag enabling/disabling this
        /// version from being served via REST APIs</param>
        /// <param name="storage">Storage flags the version as storage version.
        /// There must be exactly one flagged as storage version.</param>
        public V1beta1CustomResourceDefinitionVersion(string name, bool served, bool storage)
        {
            Name = name;
            Served = served;
            Storage = storage;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets name is the version name, e.g. “v1”, “v2beta1”, etc.
        /// </summary>
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets served is a flag enabling/disabling this version from
        /// being served via REST APIs
        /// </summary>
        [JsonProperty(PropertyName = "served")]
        public bool Served { get; set; }

        /// <summary>
        /// Gets or sets storage flags the version as storage version. There
        /// must be exactly one flagged as storage version.
        /// </summary>
        [JsonProperty(PropertyName = "storage")]
        public bool Storage { 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");
            }
        }
    }
}
