// <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>
    /// LimitRangeSpec defines a min/max usage limit for resources that match
    /// on kind.
    /// </summary>
    public partial class V1LimitRangeSpec
    {
        /// <summary>
        /// Initializes a new instance of the V1LimitRangeSpec class.
        /// </summary>
        public V1LimitRangeSpec()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1LimitRangeSpec class.
        /// </summary>
        /// <param name="limits">Limits is the list of LimitRangeItem objects
        /// that are enforced.</param>
        public V1LimitRangeSpec(IList<V1LimitRangeItem> limits)
        {
            Limits = limits;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets limits is the list of LimitRangeItem objects that are
        /// enforced.
        /// </summary>
        [JsonProperty(PropertyName = "limits")]
        public IList<V1LimitRangeItem> Limits { get; set; }

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