// <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>
    /// PodDisruptionBudgetStatus represents information about the status of a
    /// PodDisruptionBudget. Status may trail the actual state of a system.
    /// </summary>
    public partial class V1beta1PodDisruptionBudgetStatus
    {
        /// <summary>
        /// Initializes a new instance of the V1beta1PodDisruptionBudgetStatus
        /// class.
        /// </summary>
        public V1beta1PodDisruptionBudgetStatus()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1beta1PodDisruptionBudgetStatus
        /// class.
        /// </summary>
        /// <param name="currentHealthy">current number of healthy pods</param>
        /// <param name="desiredHealthy">minimum desired number of healthy
        /// pods</param>
        /// <param name="disruptedPods">DisruptedPods contains information
        /// about pods whose eviction was processed by the API server eviction
        /// subresource handler but has not yet been observed by the
        /// PodDisruptionBudget controller. A pod will be in this map from the
        /// time when the API server processed the eviction request to the time
        /// when the pod is seen by PDB controller as having been marked for
        /// deletion (or after a timeout). The key in the map is the name of
        /// the pod and the value is the time when the API server processed the
        /// eviction request. If the deletion didn't occur and a pod is still
        /// there it will be removed from the list automatically by
        /// PodDisruptionBudget controller after some time. If everything goes
        /// smooth this map should be empty for the most of the time. Large
        /// number of entries in the map may indicate problems with pod
        /// deletions.</param>
        /// <param name="disruptionsAllowed">Number of pod disruptions that are
        /// currently allowed.</param>
        /// <param name="expectedPods">total number of pods counted by this
        /// disruption budget</param>
        /// <param name="observedGeneration">Most recent generation observed
        /// when updating this PDB status. PodDisruptionsAllowed and other
        /// status informatio is valid only if observedGeneration equals to
        /// PDB's object generation.</param>
        public V1beta1PodDisruptionBudgetStatus(int currentHealthy, int desiredHealthy, IDictionary<string, System.DateTime?> disruptedPods, int disruptionsAllowed, int expectedPods, long? observedGeneration = default(long?))
        {
            CurrentHealthy = currentHealthy;
            DesiredHealthy = desiredHealthy;
            DisruptedPods = disruptedPods;
            DisruptionsAllowed = disruptionsAllowed;
            ExpectedPods = expectedPods;
            ObservedGeneration = observedGeneration;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets current number of healthy pods
        /// </summary>
        [JsonProperty(PropertyName = "currentHealthy")]
        public int CurrentHealthy { get; set; }

        /// <summary>
        /// Gets or sets minimum desired number of healthy pods
        /// </summary>
        [JsonProperty(PropertyName = "desiredHealthy")]
        public int DesiredHealthy { get; set; }

        /// <summary>
        /// Gets or sets disruptedPods contains information about pods whose
        /// eviction was processed by the API server eviction subresource
        /// handler but has not yet been observed by the PodDisruptionBudget
        /// controller. A pod will be in this map from the time when the API
        /// server processed the eviction request to the time when the pod is
        /// seen by PDB controller as having been marked for deletion (or after
        /// a timeout). The key in the map is the name of the pod and the value
        /// is the time when the API server processed the eviction request. If
        /// the deletion didn't occur and a pod is still there it will be
        /// removed from the list automatically by PodDisruptionBudget
        /// controller after some time. If everything goes smooth this map
        /// should be empty for the most of the time. Large number of entries
        /// in the map may indicate problems with pod deletions.
        /// </summary>
        [JsonProperty(PropertyName = "disruptedPods")]
        public IDictionary<string, System.DateTime?> DisruptedPods { get; set; }

        /// <summary>
        /// Gets or sets number of pod disruptions that are currently allowed.
        /// </summary>
        [JsonProperty(PropertyName = "disruptionsAllowed")]
        public int DisruptionsAllowed { get; set; }

        /// <summary>
        /// Gets or sets total number of pods counted by this disruption budget
        /// </summary>
        [JsonProperty(PropertyName = "expectedPods")]
        public int ExpectedPods { get; set; }

        /// <summary>
        /// Gets or sets most recent generation observed when updating this PDB
        /// status. PodDisruptionsAllowed and other status informatio is valid
        /// only if observedGeneration equals to PDB's object generation.
        /// </summary>
        [JsonProperty(PropertyName = "observedGeneration")]
        public long? ObservedGeneration { get; set; }

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