// <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>
    /// ObjectMetricStatus indicates the current value of a metric describing a
    /// kubernetes object (for example, hits-per-second on an Ingress object).
    /// </summary>
    public partial class V2beta2ObjectMetricStatus
    {
        /// <summary>
        /// Initializes a new instance of the V2beta2ObjectMetricStatus class.
        /// </summary>
        public V2beta2ObjectMetricStatus()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V2beta2ObjectMetricStatus class.
        /// </summary>
        /// <param name="current">current contains the current value for the
        /// given metric</param>
        /// <param name="metric">metric identifies the target metric by name
        /// and selector</param>
        public V2beta2ObjectMetricStatus(V2beta2MetricValueStatus current, V2beta2CrossVersionObjectReference describedObject, V2beta2MetricIdentifier metric)
        {
            Current = current;
            DescribedObject = describedObject;
            Metric = metric;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets current contains the current value for the given
        /// metric
        /// </summary>
        [JsonProperty(PropertyName = "current")]
        public V2beta2MetricValueStatus Current { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "describedObject")]
        public V2beta2CrossVersionObjectReference DescribedObject { get; set; }

        /// <summary>
        /// Gets or sets metric identifies the target metric by name and
        /// selector
        /// </summary>
        [JsonProperty(PropertyName = "metric")]
        public V2beta2MetricIdentifier Metric { get; set; }

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