# 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.37
    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 collections.abc import Mapping as _Mapping
from datetime import datetime
from pydantic import AliasChoices, BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, cast as _cast
from kubernetes.client.models.v1_container_status import V1ContainerStatus
from kubernetes.client.models.v1_host_ip import V1HostIP
from kubernetes.client.models.v1_node_allocatable_resource_claim_status import V1NodeAllocatableResourceClaimStatus
from kubernetes.client.models.v1_pod_condition import V1PodCondition
from kubernetes.client.models.v1_pod_extended_resource_claim_status import V1PodExtendedResourceClaimStatus
from kubernetes.client.models.v1_pod_ip import V1PodIP
from kubernetes.client.models.v1_pod_resource_claim_status import V1PodResourceClaimStatus
from kubernetes.client.models.v1_pod_volume_health import V1PodVolumeHealth
from kubernetes.client.models.v1_resource_requirements import V1ResourceRequirements
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python


_OPENAPI_GENERATOR_TO_DICT = "_openapi_generator_to_dict"


def _get_openapi_to_dict(value: Any) -> Any:
    # Reciprocal function references preserve inherited generated methods
    # without reserving model member names. Checking both directions also
    # rejects overrides whose decorators copy function attributes.
    to_dict = getattr(value, "to_dict", None)
    type_to_dict = getattr(type(value), "to_dict", None)
    if (
        not callable(to_dict)
        or getattr(to_dict, "__func__", None) is not type_to_dict
    ):
        return None

    openapi_to_dict = getattr(
        type_to_dict, _OPENAPI_GENERATOR_TO_DICT, None
    )
    if (
        not callable(openapi_to_dict)
        or getattr(
            openapi_to_dict,
            _OPENAPI_GENERATOR_TO_DICT,
            None,
        ) is not type_to_dict
    ):
        return None
    return openapi_to_dict


def _to_legacy_item(value: Any, serialize: bool) -> Any:
    to_dict = getattr(value, "to_dict", None)
    if _get_openapi_to_dict(value) is not None and callable(to_dict):
        return to_dict(serialize=serialize)
    if callable(to_dict):
        return to_dict()
    return value


def _to_legacy_value(value: Any, serialize: bool) -> Any:
    # python-legacy converted only immediate list elements or dictionary values:
    # https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L203-L231
    if isinstance(value, list):
        return [_to_legacy_item(item, serialize) for item in value]
    if isinstance(value, dict):
        return {
            key: _to_legacy_item(item, serialize)
            for key, item in value.items()
        }
    return _to_legacy_item(value, serialize)


def _to_openapi_value(value: Any) -> Any:
    if isinstance(value, list):
        return [_to_openapi_value(item) for item in value]
    if isinstance(value, dict):
        return {key: _to_openapi_value(item) for key, item in value.items()}

    to_openapi_dict = _get_openapi_to_dict(value)
    if to_openapi_dict is not None:
        return to_openapi_dict(value)

    to_dict = getattr(value, "to_dict", None)
    if callable(to_dict):
        return to_dict()
    return value


class V1PodStatus(BaseModel):
    """
    PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.

    Attributes:
      openapi_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """ # noqa: E501
    allocated_resources: Optional[Dict[str, StrictStr]] = Field(default=None, validation_alias=AliasChoices("allocatedResources", "allocated_resources"), serialization_alias="allocatedResources", description="AllocatedResources is the total requests allocated for this pod by the node. If pod-level requests are not set, this will be the total requests aggregated across containers in the pod.")
    conditions: Optional[List[V1PodCondition]] = Field(default=None, description="Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions")
    container_statuses: Optional[List[V1ContainerStatus]] = Field(default=None, validation_alias=AliasChoices("containerStatuses", "container_statuses"), serialization_alias="containerStatuses", description="Statuses of containers in this pod. Each container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status")
    ephemeral_container_statuses: Optional[List[V1ContainerStatus]] = Field(default=None, validation_alias=AliasChoices("ephemeralContainerStatuses", "ephemeral_container_statuses"), serialization_alias="ephemeralContainerStatuses", description="Statuses for any ephemeral containers that have run in this pod. Each ephemeral container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status")
    extended_resource_claim_status: Optional[V1PodExtendedResourceClaimStatus] = Field(default=None, validation_alias=AliasChoices("extendedResourceClaimStatus", "extended_resource_claim_status"), serialization_alias="extendedResourceClaimStatus")
    host_ip: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("hostIP", "host_ip"), serialization_alias="hostIP", description="hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is a node is assigned to pod")
    host_ips: Optional[List[V1HostIP]] = Field(default=None, validation_alias=AliasChoices("hostIPs", "host_ips"), serialization_alias="hostIPs", description="hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod.")
    init_container_statuses: Optional[List[V1ContainerStatus]] = Field(default=None, validation_alias=AliasChoices("initContainerStatuses", "init_container_statuses"), serialization_alias="initContainerStatuses", description="Statuses of init containers in this pod. The most recent successful non-restartable init container will have ready = true, the most recently started container will have startTime set. Each init container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status")
    message: Optional[StrictStr] = Field(default=None, description="A human readable message indicating details about why the pod is in this condition.")
    node_allocatable_resource_claim_statuses: Optional[List[V1NodeAllocatableResourceClaimStatus]] = Field(default=None, validation_alias=AliasChoices("nodeAllocatableResourceClaimStatuses", "node_allocatable_resource_claim_statuses"), serialization_alias="nodeAllocatableResourceClaimStatuses", description="NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources that were allocated for this pod through DRA claims. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages.")
    nominated_node_name: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("nominatedNodeName", "nominated_node_name"), serialization_alias="nominatedNodeName", description="nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.")
    observed_generation: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("observedGeneration", "observed_generation"), serialization_alias="observedGeneration", description="If set, this represents the .metadata.generation that the pod status was set based upon. The PodObservedGenerationTracking feature gate must be enabled to use this field.")
    phase: Optional[StrictStr] = Field(default=None, description="The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod's status. There are five possible phase values:  Pending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.  More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase")
    pod_ip: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("podIP", "pod_ip"), serialization_alias="podIP", description="podIP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.")
    pod_ips: Optional[List[V1PodIP]] = Field(default=None, validation_alias=AliasChoices("podIPs", "pod_ips"), serialization_alias="podIPs", description="podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet.")
    qos_class: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("qosClass", "qos_class"), serialization_alias="qosClass", description="The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes")
    reason: Optional[StrictStr] = Field(default=None, description="A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'")
    resize: Optional[StrictStr] = Field(default=None, description="Status of resources resize desired for pod's containers. It is empty if no resources resize is pending. Any changes to container resources will automatically set this to \"Proposed\" Deprecated: Resize status is moved to two pod conditions PodResizePending and PodResizeInProgress. PodResizePending will track states where the spec has been resized, but the Kubelet has not yet allocated the resources. PodResizeInProgress will track in-progress resizes, and should be present whenever allocated resources != acknowledged resources.")
    resource_claim_statuses: Optional[List[V1PodResourceClaimStatus]] = Field(default=None, validation_alias=AliasChoices("resourceClaimStatuses", "resource_claim_statuses"), serialization_alias="resourceClaimStatuses", description="Status of resource claims.")
    resources: Optional[V1ResourceRequirements] = None
    start_time: Optional[datetime] = Field(default=None, validation_alias=AliasChoices("startTime", "start_time"), serialization_alias="startTime", description="RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.")
    volume_health: Optional[List[V1PodVolumeHealth]] = Field(default=None, validation_alias=AliasChoices("volumeHealth", "volume_health"), serialization_alias="volumeHealth", description="volumeHealth contains node-reported health for each volume the pod is using. Populated by the kubelet on the pod's node.")
    openapi_types: ClassVar[Dict[str, str]] = {
        "allocated_resources": "Dict[str, str]",
        "conditions": "List[V1PodCondition]",
        "container_statuses": "List[V1ContainerStatus]",
        "ephemeral_container_statuses": "List[V1ContainerStatus]",
        "extended_resource_claim_status": "V1PodExtendedResourceClaimStatus",
        "host_ip": "str",
        "host_ips": "List[V1HostIP]",
        "init_container_statuses": "List[V1ContainerStatus]",
        "message": "str",
        "node_allocatable_resource_claim_statuses": "List[V1NodeAllocatableResourceClaimStatus]",
        "nominated_node_name": "str",
        "observed_generation": "int",
        "phase": "str",
        "pod_ip": "str",
        "pod_ips": "List[V1PodIP]",
        "qos_class": "str",
        "reason": "str",
        "resize": "str",
        "resource_claim_statuses": "List[V1PodResourceClaimStatus]",
        "resources": "V1ResourceRequirements",
        "start_time": "datetime",
        "volume_health": "List[V1PodVolumeHealth]"
    }

    attribute_map: ClassVar[Dict[str, str]] = {
        "allocated_resources": "allocatedResources",
        "conditions": "conditions",
        "container_statuses": "containerStatuses",
        "ephemeral_container_statuses": "ephemeralContainerStatuses",
        "extended_resource_claim_status": "extendedResourceClaimStatus",
        "host_ip": "hostIP",
        "host_ips": "hostIPs",
        "init_container_statuses": "initContainerStatuses",
        "message": "message",
        "node_allocatable_resource_claim_statuses": "nodeAllocatableResourceClaimStatuses",
        "nominated_node_name": "nominatedNodeName",
        "observed_generation": "observedGeneration",
        "phase": "phase",
        "pod_ip": "podIP",
        "pod_ips": "podIPs",
        "qos_class": "qosClass",
        "reason": "reason",
        "resize": "resize",
        "resource_claim_statuses": "resourceClaimStatuses",
        "resources": "resources",
        "start_time": "startTime",
        "volume_health": "volumeHealth"
    }
    __properties: ClassVar[List[str]] = ["allocatedResources", "conditions", "containerStatuses", "ephemeralContainerStatuses", "extendedResourceClaimStatus", "hostIP", "hostIPs", "initContainerStatuses", "message", "nodeAllocatableResourceClaimStatuses", "nominatedNodeName", "observedGeneration", "phase", "podIP", "podIPs", "qosClass", "reason", "resize", "resourceClaimStatuses", "resources", "startTime", "volumeHealth"]

    @classmethod
    def __preprocess_input_names(
        cls,
        obj: Any,
        remove_hidden_storage_names: bool = True,
    ) -> Any:
        if not isinstance(obj, _Mapping):
            return obj
        obj = dict(obj)
        if "allocatedResources" not in obj and "allocated_resources" in obj:
            obj["allocatedResources"] = obj["allocated_resources"]
        obj.pop("allocated_resources", None)
        if "containerStatuses" not in obj and "container_statuses" in obj:
            obj["containerStatuses"] = obj["container_statuses"]
        obj.pop("container_statuses", None)
        if "ephemeralContainerStatuses" not in obj and "ephemeral_container_statuses" in obj:
            obj["ephemeralContainerStatuses"] = obj["ephemeral_container_statuses"]
        obj.pop("ephemeral_container_statuses", None)
        if "extendedResourceClaimStatus" not in obj and "extended_resource_claim_status" in obj:
            obj["extendedResourceClaimStatus"] = obj["extended_resource_claim_status"]
        obj.pop("extended_resource_claim_status", None)
        if "hostIP" not in obj and "host_ip" in obj:
            obj["hostIP"] = obj["host_ip"]
        obj.pop("host_ip", None)
        if "hostIPs" not in obj and "host_ips" in obj:
            obj["hostIPs"] = obj["host_ips"]
        obj.pop("host_ips", None)
        if "initContainerStatuses" not in obj and "init_container_statuses" in obj:
            obj["initContainerStatuses"] = obj["init_container_statuses"]
        obj.pop("init_container_statuses", None)
        if "nodeAllocatableResourceClaimStatuses" not in obj and "node_allocatable_resource_claim_statuses" in obj:
            obj["nodeAllocatableResourceClaimStatuses"] = obj["node_allocatable_resource_claim_statuses"]
        obj.pop("node_allocatable_resource_claim_statuses", None)
        if "nominatedNodeName" not in obj and "nominated_node_name" in obj:
            obj["nominatedNodeName"] = obj["nominated_node_name"]
        obj.pop("nominated_node_name", None)
        if "observedGeneration" not in obj and "observed_generation" in obj:
            obj["observedGeneration"] = obj["observed_generation"]
        obj.pop("observed_generation", None)
        if "podIP" not in obj and "pod_ip" in obj:
            obj["podIP"] = obj["pod_ip"]
        obj.pop("pod_ip", None)
        if "podIPs" not in obj and "pod_ips" in obj:
            obj["podIPs"] = obj["pod_ips"]
        obj.pop("pod_ips", None)
        if "qosClass" not in obj and "qos_class" in obj:
            obj["qosClass"] = obj["qos_class"]
        obj.pop("qos_class", None)
        if "resourceClaimStatuses" not in obj and "resource_claim_statuses" in obj:
            obj["resourceClaimStatuses"] = obj["resource_claim_statuses"]
        obj.pop("resource_claim_statuses", None)
        if "startTime" not in obj and "start_time" in obj:
            obj["startTime"] = obj["start_time"]
        obj.pop("start_time", None)
        if "volumeHealth" not in obj and "volume_health" in obj:
            obj["volumeHealth"] = obj["volume_health"]
        obj.pop("volume_health", None)
        return obj

    model_config = ConfigDict(
        validate_by_name=True,
        validate_by_alias=True,
        validate_assignment=True,
        extra="forbid",
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self) -> str:
        """For print and pprint"""
        return self.to_str()

    def __eq__(self, other: object) -> bool:
        """Returns true if both objects are equal"""
        if not isinstance(other, V1PodStatus):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other: object) -> bool:
        """Returns true if both objects are not equal"""
        if not isinstance(other, V1PodStatus):
            return True

        return not (self == other)


    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        to_openapi_dict = _get_openapi_to_dict(self)
        if to_openapi_dict is not None:
            return json.dumps(to_jsonable_python(to_openapi_dict(self)))
        return json.dumps(to_jsonable_python(self.to_dict()))

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

    def to_dict(self, serialize: bool = False) -> Dict[str, Any]:
        """Return all declared model fields using public or wire names."""
        return {
            ("allocatedResources" if serialize else "allocated_resources"): _to_legacy_value(getattr(self, "allocated_resources", None), serialize),
            ("conditions" if serialize else "conditions"): _to_legacy_value(getattr(self, "conditions", None), serialize),
            ("containerStatuses" if serialize else "container_statuses"): _to_legacy_value(getattr(self, "container_statuses", None), serialize),
            ("ephemeralContainerStatuses" if serialize else "ephemeral_container_statuses"): _to_legacy_value(getattr(self, "ephemeral_container_statuses", None), serialize),
            ("extendedResourceClaimStatus" if serialize else "extended_resource_claim_status"): _to_legacy_value(getattr(self, "extended_resource_claim_status", None), serialize),
            ("hostIP" if serialize else "host_ip"): _to_legacy_value(getattr(self, "host_ip", None), serialize),
            ("hostIPs" if serialize else "host_ips"): _to_legacy_value(getattr(self, "host_ips", None), serialize),
            ("initContainerStatuses" if serialize else "init_container_statuses"): _to_legacy_value(getattr(self, "init_container_statuses", None), serialize),
            ("message" if serialize else "message"): _to_legacy_value(getattr(self, "message", None), serialize),
            ("nodeAllocatableResourceClaimStatuses" if serialize else "node_allocatable_resource_claim_statuses"): _to_legacy_value(getattr(self, "node_allocatable_resource_claim_statuses", None), serialize),
            ("nominatedNodeName" if serialize else "nominated_node_name"): _to_legacy_value(getattr(self, "nominated_node_name", None), serialize),
            ("observedGeneration" if serialize else "observed_generation"): _to_legacy_value(getattr(self, "observed_generation", None), serialize),
            ("phase" if serialize else "phase"): _to_legacy_value(getattr(self, "phase", None), serialize),
            ("podIP" if serialize else "pod_ip"): _to_legacy_value(getattr(self, "pod_ip", None), serialize),
            ("podIPs" if serialize else "pod_ips"): _to_legacy_value(getattr(self, "pod_ips", None), serialize),
            ("qosClass" if serialize else "qos_class"): _to_legacy_value(getattr(self, "qos_class", None), serialize),
            ("reason" if serialize else "reason"): _to_legacy_value(getattr(self, "reason", None), serialize),
            ("resize" if serialize else "resize"): _to_legacy_value(getattr(self, "resize", None), serialize),
            ("resourceClaimStatuses" if serialize else "resource_claim_statuses"): _to_legacy_value(getattr(self, "resource_claim_statuses", None), serialize),
            ("resources" if serialize else "resources"): _to_legacy_value(getattr(self, "resources", None), serialize),
            ("startTime" if serialize else "start_time"): _to_legacy_value(getattr(self, "start_time", None), serialize),
            ("volumeHealth" if serialize else "volume_health"): _to_legacy_value(getattr(self, "volume_health", None), serialize),
        }

    def __openapi_generator_modern_projection(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            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_conditions in self.conditions:
                _items.append(_to_openapi_value(_item_conditions) if _item_conditions is not None else None)
            _dict['conditions'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in container_statuses (list)
        _items = []
        if self.container_statuses:
            for _item_container_statuses in self.container_statuses:
                _items.append(_to_openapi_value(_item_container_statuses) if _item_container_statuses is not None else None)
            _dict['containerStatuses'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in ephemeral_container_statuses (list)
        _items = []
        if self.ephemeral_container_statuses:
            for _item_ephemeral_container_statuses in self.ephemeral_container_statuses:
                _items.append(_to_openapi_value(_item_ephemeral_container_statuses) if _item_ephemeral_container_statuses is not None else None)
            _dict['ephemeralContainerStatuses'] = _items
        # override the default output from pydantic by calling `to_dict()` of extended_resource_claim_status
        if self.extended_resource_claim_status:
            _dict['extendedResourceClaimStatus'] = _to_openapi_value(self.extended_resource_claim_status)
        # override the default output from pydantic by calling `to_dict()` of each item in host_ips (list)
        _items = []
        if self.host_ips:
            for _item_host_ips in self.host_ips:
                _items.append(_to_openapi_value(_item_host_ips) if _item_host_ips is not None else None)
            _dict['hostIPs'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in init_container_statuses (list)
        _items = []
        if self.init_container_statuses:
            for _item_init_container_statuses in self.init_container_statuses:
                _items.append(_to_openapi_value(_item_init_container_statuses) if _item_init_container_statuses is not None else None)
            _dict['initContainerStatuses'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in node_allocatable_resource_claim_statuses (list)
        _items = []
        if self.node_allocatable_resource_claim_statuses:
            for _item_node_allocatable_resource_claim_statuses in self.node_allocatable_resource_claim_statuses:
                _items.append(_to_openapi_value(_item_node_allocatable_resource_claim_statuses) if _item_node_allocatable_resource_claim_statuses is not None else None)
            _dict['nodeAllocatableResourceClaimStatuses'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in pod_ips (list)
        _items = []
        if self.pod_ips:
            for _item_pod_ips in self.pod_ips:
                _items.append(_to_openapi_value(_item_pod_ips) if _item_pod_ips is not None else None)
            _dict['podIPs'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in resource_claim_statuses (list)
        _items = []
        if self.resource_claim_statuses:
            for _item_resource_claim_statuses in self.resource_claim_statuses:
                _items.append(_to_openapi_value(_item_resource_claim_statuses) if _item_resource_claim_statuses is not None else None)
            _dict['resourceClaimStatuses'] = _items
        # override the default output from pydantic by calling `to_dict()` of resources
        if self.resources:
            _dict['resources'] = _to_openapi_value(self.resources)
        # override the default output from pydantic by calling `to_dict()` of each item in volume_health (list)
        _items = []
        if self.volume_health:
            for _item_volume_health in self.volume_health:
                _items.append(_to_openapi_value(_item_volume_health) if _item_volume_health is not None else None)
            _dict['volumeHealth'] = _items
        return _dict

    setattr(
        to_dict,
        _OPENAPI_GENERATOR_TO_DICT,
        __openapi_generator_modern_projection,
    )
    setattr(
        __openapi_generator_modern_projection,
        _OPENAPI_GENERATOR_TO_DICT,
        to_dict,
    )
    del __openapi_generator_modern_projection

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of V1PodStatus from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        obj = _cast(
            Dict[str, Any],
            cls.__preprocess_input_names(
                obj,
                remove_hidden_storage_names=True,
            ),
        )

        _obj = cls.model_validate({
            "allocatedResources": obj.get("allocatedResources"),
            "conditions": [V1PodCondition.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None,
            "containerStatuses": [V1ContainerStatus.from_dict(_item) for _item in obj["containerStatuses"]] if obj.get("containerStatuses") is not None else None,
            "ephemeralContainerStatuses": [V1ContainerStatus.from_dict(_item) for _item in obj["ephemeralContainerStatuses"]] if obj.get("ephemeralContainerStatuses") is not None else None,
            "extendedResourceClaimStatus": V1PodExtendedResourceClaimStatus.from_dict(obj["extendedResourceClaimStatus"]) if obj.get("extendedResourceClaimStatus") is not None else None,
            "hostIP": obj.get("hostIP"),
            "hostIPs": [V1HostIP.from_dict(_item) for _item in obj["hostIPs"]] if obj.get("hostIPs") is not None else None,
            "initContainerStatuses": [V1ContainerStatus.from_dict(_item) for _item in obj["initContainerStatuses"]] if obj.get("initContainerStatuses") is not None else None,
            "message": obj.get("message"),
            "nodeAllocatableResourceClaimStatuses": [V1NodeAllocatableResourceClaimStatus.from_dict(_item) for _item in obj["nodeAllocatableResourceClaimStatuses"]] if obj.get("nodeAllocatableResourceClaimStatuses") is not None else None,
            "nominatedNodeName": obj.get("nominatedNodeName"),
            "observedGeneration": obj.get("observedGeneration"),
            "phase": obj.get("phase"),
            "podIP": obj.get("podIP"),
            "podIPs": [V1PodIP.from_dict(_item) for _item in obj["podIPs"]] if obj.get("podIPs") is not None else None,
            "qosClass": obj.get("qosClass"),
            "reason": obj.get("reason"),
            "resize": obj.get("resize"),
            "resourceClaimStatuses": [V1PodResourceClaimStatus.from_dict(_item) for _item in obj["resourceClaimStatuses"]] if obj.get("resourceClaimStatuses") is not None else None,
            "resources": V1ResourceRequirements.from_dict(obj["resources"]) if obj.get("resources") is not None else None,
            "startTime": obj.get("startTime"),
            "volumeHealth": [V1PodVolumeHealth.from_dict(_item) for _item in obj["volumeHealth"]] if obj.get("volumeHealth") is not None else None
        })
        return _obj
