// <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>
    /// MetricTarget defines the target value, average value, or average
    /// utilization of a specific metric
    /// </summary>
    public partial class V2beta2MetricTarget
    {
        /// <summary>
        /// Initializes a new instance of the V2beta2MetricTarget class.
        /// </summary>
        public V2beta2MetricTarget()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V2beta2MetricTarget class.
        /// </summary>
        /// <param name="type">type represents whether the metric type is
        /// Utilization, Value, or AverageValue</param>
        /// <param name="averageUtilization">averageUtilization is the target
        /// value of the average of the resource metric across all relevant
        /// pods, represented as a percentage of the requested value of the
        /// resource for the pods. Currently only valid for Resource metric
        /// source type</param>
        /// <param name="averageValue">averageValue is the target value of the
        /// average of the metric across all relevant pods (as a
        /// quantity)</param>
        /// <param name="value">value is the target value of the metric (as a
        /// quantity).</param>
        public V2beta2MetricTarget(string type, int? averageUtilization = default(int?), ResourceQuantity averageValue = default(ResourceQuantity), ResourceQuantity value = default(ResourceQuantity))
        {
            AverageUtilization = averageUtilization;
            AverageValue = averageValue;
            Type = type;
            Value = value;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets averageUtilization is the target value of the average
        /// of the resource metric across all relevant pods, represented as a
        /// percentage of the requested value of the resource for the pods.
        /// Currently only valid for Resource metric source type
        /// </summary>
        [JsonProperty(PropertyName = "averageUtilization")]
        public int? AverageUtilization { get; set; }

        /// <summary>
        /// Gets or sets averageValue is the target value of the average of the
        /// metric across all relevant pods (as a quantity)
        /// </summary>
        [JsonProperty(PropertyName = "averageValue")]
        public ResourceQuantity AverageValue { get; set; }

        /// <summary>
        /// Gets or sets type represents whether the metric type is
        /// Utilization, Value, or AverageValue
        /// </summary>
        [JsonProperty(PropertyName = "type")]
        public string Type { get; set; }

        /// <summary>
        /// Gets or sets value is the target value of the metric (as a
        /// quantity).
        /// </summary>
        [JsonProperty(PropertyName = "value")]
        public ResourceQuantity Value { get; set; }

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