# coding: utf-8

"""
    Kubernetes

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: release-1.29
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import List, Optional
from pydantic import BaseModel, Field, StrictInt, conlist
from .v1_daemon_set_condition import V1DaemonSetCondition

class V1DaemonSetStatus(BaseModel):
    """
    DaemonSetStatus represents the current status of a daemon set.  # noqa: E501
    """
    collision_count: Optional[StrictInt] = Field(None, alias="collisionCount", description="Count of hash collisions for the DaemonSet. The DaemonSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.")
    conditions: Optional[conlist(V1DaemonSetCondition)] = Field(None, description="Represents the latest available observations of a DaemonSet's current state.")
    current_number_scheduled: StrictInt = Field(..., alias="currentNumberScheduled", description="The number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/")
    desired_number_scheduled: StrictInt = Field(..., alias="desiredNumberScheduled", description="The total number of nodes that should be running the daemon pod (including nodes correctly running the daemon pod). More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/")
    number_available: Optional[StrictInt] = Field(None, alias="numberAvailable", description="The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds)")
    number_misscheduled: StrictInt = Field(..., alias="numberMisscheduled", description="The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/")
    number_ready: StrictInt = Field(..., alias="numberReady", description="numberReady is the number of nodes that should be running the daemon pod and have one or more of the daemon pod running with a Ready Condition.")
    number_unavailable: Optional[StrictInt] = Field(None, alias="numberUnavailable", description="The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds)")
    observed_generation: Optional[StrictInt] = Field(None, alias="observedGeneration", description="The most recent generation observed by the daemon set controller.")
    updated_number_scheduled: Optional[StrictInt] = Field(None, alias="updatedNumberScheduled", description="The total number of nodes that are running updated daemon pod")
    __properties = ["collisionCount", "conditions", "currentNumberScheduled", "desiredNumberScheduled", "numberAvailable", "numberMisscheduled", "numberReady", "numberUnavailable", "observedGeneration", "updatedNumberScheduled"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> V1DaemonSetStatus:
        """Create an instance of V1DaemonSetStatus from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of each item in conditions (list)
        _items = []
        if self.conditions:
            for _item in self.conditions:
                if _item:
                    _items.append(_item.to_dict())
            _dict['conditions'] = _items
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> V1DaemonSetStatus:
        """Create an instance of V1DaemonSetStatus from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return V1DaemonSetStatus.parse_obj(obj)

        _obj = V1DaemonSetStatus.parse_obj({
            "collision_count": obj.get("collisionCount"),
            "conditions": [V1DaemonSetCondition.from_dict(_item) for _item in obj.get("conditions")] if obj.get("conditions") is not None else None,
            "current_number_scheduled": obj.get("currentNumberScheduled"),
            "desired_number_scheduled": obj.get("desiredNumberScheduled"),
            "number_available": obj.get("numberAvailable"),
            "number_misscheduled": obj.get("numberMisscheduled"),
            "number_ready": obj.get("numberReady"),
            "number_unavailable": obj.get("numberUnavailable"),
            "observed_generation": obj.get("observedGeneration"),
            "updated_number_scheduled": obj.get("updatedNumberScheduled")
        })
        return _obj


