# 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 pydantic import AliasChoices, BaseModel, ConfigDict, Field, ModelWrapValidatorHandler as _ModelWrapValidatorHandler, StrictBool, StrictFloat, StrictInt, StrictStr, model_validator as _model_validator
from typing import Any, ClassVar, Dict, List, Optional, Union, cast as _cast
from kubernetes.client.models.v1_external_documentation import V1ExternalDocumentation
from kubernetes.client.models.v1_validation_rule import V1ValidationRule
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
from typing import TYPE_CHECKING


_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 V1JSONSchemaProps(BaseModel):
    """
    JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).

    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
    ref: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("$ref", "ref"), serialization_alias="$ref")
    var_schema: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("$schema", "schema"), serialization_alias="$schema", alias="schema")
    additional_items: Optional[Dict[str, Any] | StrictBool] = Field(default=None, validation_alias=AliasChoices("additionalItems", "additional_items"), serialization_alias="additionalItems", description="JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.")
    additional_properties: Optional[Dict[str, Any] | StrictBool] = Field(default=None, validation_alias=AliasChoices("additionalProperties", "additional_properties"), serialization_alias="additionalProperties", description="JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.")
    all_of: Optional[List[V1JSONSchemaProps]] = Field(default=None, validation_alias=AliasChoices("allOf", "all_of"), serialization_alias="allOf")
    any_of: Optional[List[V1JSONSchemaProps]] = Field(default=None, validation_alias=AliasChoices("anyOf", "any_of"), serialization_alias="anyOf")
    default: Any = Field(default=None, description="default is a default value for undefined object fields. Defaulting is a beta feature under the CustomResourceDefaulting feature gate. Defaulting requires spec.preserveUnknownFields to be false.")
    definitions: Optional[Dict[str, V1JSONSchemaProps]] = None
    dependencies: Optional[Dict[str, Dict[str, Any] | List[str]]] = None
    description: Optional[StrictStr] = None
    enum: Optional[List[Any]] = None
    example: Any = Field(default=None, description="JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.")
    exclusive_maximum: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("exclusiveMaximum", "exclusive_maximum"), serialization_alias="exclusiveMaximum")
    exclusive_minimum: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("exclusiveMinimum", "exclusive_minimum"), serialization_alias="exclusiveMinimum")
    external_docs: Optional[V1ExternalDocumentation] = Field(default=None, validation_alias=AliasChoices("externalDocs", "external_docs"), serialization_alias="externalDocs")
    format: Optional[StrictStr] = Field(default=None, description="format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated:  - bsonobjectid: a bson object ID, i.e. a 24 characters hex string - uri: an URI as parsed by Golang net/url.ParseRequestURI - email: an email address as parsed by Golang net/mail.ParseAddress - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. - ipv4: an IPv4 IP as parsed by Golang net.ParseIP - ipv6: an IPv6 IP as parsed by Golang net.ParseIP - cidr: a CIDR as parsed by Golang net.ParseCIDR - mac: a MAC address as parsed by Golang net.ParseMAC - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - isbn: an ISBN10 or ISBN13 number string like \"0321751043\" or \"978-0321751041\" - isbn10: an ISBN10 number string like \"0321751043\" - isbn13: an ISBN13 number string like \"978-0321751041\" - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\\\d{3})\\\\d{11})$ with any non digit characters mixed in - ssn: a U.S. social security number following the regex ^\\\\d{3}[- ]?\\\\d{2}[- ]?\\\\d{4}$ - hexcolor: an hexadecimal color code like \"#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ - rgbcolor: an RGB color code like rgb like \"rgb(255,255,2559\" - byte: base64 encoded binary data - password: any kind of string - date: a date string like \"2006-01-02\" as defined by full-date in RFC3339 - duration: a duration string like \"22 ns\" as parsed by Golang time.ParseDuration or compatible with Scala duration format - datetime: a date time string like \"2014-12-15T19:30:20.000Z\" as defined by date-time in RFC3339.")
    id: Optional[StrictStr] = None
    items: Optional[Dict[str, Any] | List[Dict[str, Any]]] = Field(default=None, description="JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps or an array of JSONSchemaProps. Mainly here for serialization purposes.")
    max_items: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("maxItems", "max_items"), serialization_alias="maxItems")
    max_length: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("maxLength", "max_length"), serialization_alias="maxLength")
    max_properties: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("maxProperties", "max_properties"), serialization_alias="maxProperties")
    maximum: Optional[Union[StrictFloat, StrictInt]] = None
    min_items: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("minItems", "min_items"), serialization_alias="minItems")
    min_length: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("minLength", "min_length"), serialization_alias="minLength")
    min_properties: Optional[StrictInt] = Field(default=None, validation_alias=AliasChoices("minProperties", "min_properties"), serialization_alias="minProperties")
    minimum: Optional[Union[StrictFloat, StrictInt]] = None
    multiple_of: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, validation_alias=AliasChoices("multipleOf", "multiple_of"), serialization_alias="multipleOf")
    var_not: Optional[V1JSONSchemaProps] = Field(default=None, validation_alias=AliasChoices("not", "_not"), serialization_alias="not", alias="_not")
    nullable: Optional[StrictBool] = None
    one_of: Optional[List[V1JSONSchemaProps]] = Field(default=None, validation_alias=AliasChoices("oneOf", "one_of"), serialization_alias="oneOf")
    pattern: Optional[StrictStr] = None
    pattern_properties: Optional[Dict[str, V1JSONSchemaProps]] = Field(default=None, validation_alias=AliasChoices("patternProperties", "pattern_properties"), serialization_alias="patternProperties")
    properties: Optional[Dict[str, V1JSONSchemaProps]] = None
    required: Optional[List[StrictStr]] = None
    title: Optional[StrictStr] = None
    type: Optional[StrictStr] = None
    unique_items: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("uniqueItems", "unique_items"), serialization_alias="uniqueItems")
    x_kubernetes_embedded_resource: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-embedded-resource", "x_kubernetes_embedded_resource"), serialization_alias="x-kubernetes-embedded-resource", description="x-kubernetes-embedded-resource defines that the value is an embedded Kubernetes runtime.Object, with TypeMeta and ObjectMeta. The type must be object. It is allowed to further restrict the embedded object. kind, apiVersion and metadata are validated automatically. x-kubernetes-preserve-unknown-fields is allowed to be true, but does not have to be if the object is fully specified (up to kind, apiVersion, metadata).")
    x_kubernetes_int_or_string: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-int-or-string", "x_kubernetes_int_or_string"), serialization_alias="x-kubernetes-int-or-string", description="x-kubernetes-int-or-string specifies that this value is either an integer or a string. If this is true, an empty type is allowed and type as child of anyOf is permitted if following one of the following patterns:  1) anyOf:    - type: integer    - type: string 2) allOf:    - anyOf:      - type: integer      - type: string    - ... zero or more")
    x_kubernetes_list_map_keys: Optional[List[StrictStr]] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-list-map-keys", "x_kubernetes_list_map_keys"), serialization_alias="x-kubernetes-list-map-keys", description="x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used as the index of the map.  This tag MUST only be used on lists that have the \"x-kubernetes-list-type\" extension set to \"map\". Also, the values specified for this attribute must be a scalar typed field of the child structure (no nesting is supported).  The properties specified must either be required or have a default value, to ensure those properties are present for all list items.")
    x_kubernetes_list_type: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-list-type", "x_kubernetes_list_type"), serialization_alias="x-kubernetes-list-type", description="x-kubernetes-list-type annotates an array to further describe its topology. This extension must only be used on lists and may have 3 possible values:  1) `atomic`: the list is treated as a single entity, like a scalar.      Atomic lists will be entirely replaced when updated. This extension      may be used on any type of list (struct, scalar, ...). 2) `set`:      Sets are lists that must not have multiple items with the same value. Each      value must be a scalar, an object with x-kubernetes-map-type `atomic` or an      array with x-kubernetes-list-type `atomic`. 3) `map`:      These lists are like maps in that their elements have a non-index key      used to identify them. Order is preserved upon merge. The map tag      must only be used on a list with elements of type object. Defaults to atomic for arrays.")
    x_kubernetes_map_type: Optional[StrictStr] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-map-type", "x_kubernetes_map_type"), serialization_alias="x-kubernetes-map-type", description="x-kubernetes-map-type annotates an object to further describe its topology. This extension must only be used when type is object and may have 2 possible values:  1) `granular`:      These maps are actual maps (key-value pairs) and each fields are independent      from each other (they can each be manipulated by separate actors). This is      the default behaviour for all maps. 2) `atomic`: the list is treated as a single entity, like a scalar.      Atomic maps will be entirely replaced when updated.")
    x_kubernetes_preserve_unknown_fields: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-preserve-unknown-fields", "x_kubernetes_preserve_unknown_fields"), serialization_alias="x-kubernetes-preserve-unknown-fields", description="x-kubernetes-preserve-unknown-fields stops the API server decoding step from pruning fields which are not specified in the validation schema. This affects fields recursively, but switches back to normal pruning behaviour if nested properties or additionalProperties are specified in the schema. This can either be true or undefined. False is forbidden.")
    x_kubernetes_validations: Optional[List[V1ValidationRule]] = Field(default=None, validation_alias=AliasChoices("x-kubernetes-validations", "x_kubernetes_validations"), serialization_alias="x-kubernetes-validations", description="x-kubernetes-validations describes a list of validation rules written in the CEL expression language.")
    openapi_types: ClassVar[Dict[str, str]] = {
        "ref": "str",
        "schema": "str",
        "additional_items": "object",
        "additional_properties": "object",
        "all_of": "List[V1JSONSchemaProps]",
        "any_of": "List[V1JSONSchemaProps]",
        "default": "object",
        "definitions": "Dict[str, V1JSONSchemaProps]",
        "dependencies": "Dict[str, object]",
        "description": "str",
        "enum": "List[object]",
        "example": "object",
        "exclusive_maximum": "bool",
        "exclusive_minimum": "bool",
        "external_docs": "V1ExternalDocumentation",
        "format": "str",
        "id": "str",
        "items": "object",
        "max_items": "int",
        "max_length": "int",
        "max_properties": "int",
        "maximum": "float",
        "min_items": "int",
        "min_length": "int",
        "min_properties": "int",
        "minimum": "float",
        "multiple_of": "float",
        "_not": "V1JSONSchemaProps",
        "nullable": "bool",
        "one_of": "List[V1JSONSchemaProps]",
        "pattern": "str",
        "pattern_properties": "Dict[str, V1JSONSchemaProps]",
        "properties": "Dict[str, V1JSONSchemaProps]",
        "required": "List[str]",
        "title": "str",
        "type": "str",
        "unique_items": "bool",
        "x_kubernetes_embedded_resource": "bool",
        "x_kubernetes_int_or_string": "bool",
        "x_kubernetes_list_map_keys": "List[str]",
        "x_kubernetes_list_type": "str",
        "x_kubernetes_map_type": "str",
        "x_kubernetes_preserve_unknown_fields": "bool",
        "x_kubernetes_validations": "List[V1ValidationRule]"
    }

    attribute_map: ClassVar[Dict[str, str]] = {
        "ref": "$ref",
        "schema": "$schema",
        "additional_items": "additionalItems",
        "additional_properties": "additionalProperties",
        "all_of": "allOf",
        "any_of": "anyOf",
        "default": "default",
        "definitions": "definitions",
        "dependencies": "dependencies",
        "description": "description",
        "enum": "enum",
        "example": "example",
        "exclusive_maximum": "exclusiveMaximum",
        "exclusive_minimum": "exclusiveMinimum",
        "external_docs": "externalDocs",
        "format": "format",
        "id": "id",
        "items": "items",
        "max_items": "maxItems",
        "max_length": "maxLength",
        "max_properties": "maxProperties",
        "maximum": "maximum",
        "min_items": "minItems",
        "min_length": "minLength",
        "min_properties": "minProperties",
        "minimum": "minimum",
        "multiple_of": "multipleOf",
        "_not": "not",
        "nullable": "nullable",
        "one_of": "oneOf",
        "pattern": "pattern",
        "pattern_properties": "patternProperties",
        "properties": "properties",
        "required": "required",
        "title": "title",
        "type": "type",
        "unique_items": "uniqueItems",
        "x_kubernetes_embedded_resource": "x-kubernetes-embedded-resource",
        "x_kubernetes_int_or_string": "x-kubernetes-int-or-string",
        "x_kubernetes_list_map_keys": "x-kubernetes-list-map-keys",
        "x_kubernetes_list_type": "x-kubernetes-list-type",
        "x_kubernetes_map_type": "x-kubernetes-map-type",
        "x_kubernetes_preserve_unknown_fields": "x-kubernetes-preserve-unknown-fields",
        "x_kubernetes_validations": "x-kubernetes-validations"
    }
    __properties: ClassVar[List[str]] = ["$ref", "$schema", "additionalItems", "additionalProperties", "allOf", "anyOf", "default", "definitions", "dependencies", "description", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "id", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "not", "nullable", "oneOf", "pattern", "patternProperties", "properties", "required", "title", "type", "uniqueItems", "x-kubernetes-embedded-resource", "x-kubernetes-int-or-string", "x-kubernetes-list-map-keys", "x-kubernetes-list-type", "x-kubernetes-map-type", "x-kubernetes-preserve-unknown-fields", "x-kubernetes-validations"]

    @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 "$ref" not in obj and "ref" in obj:
            obj["$ref"] = obj["ref"]
        obj.pop("ref", None)
        if (
            "$schema" in obj
            and "schema" in obj
        ):
            raise ValueError(
                "%s received both %r and %r"
                % (
                    cls.__name__,
                    "$schema",
                    "schema",
                )
            )
        if "$schema" not in obj and "schema" in obj:
            obj["$schema"] = obj["schema"]
        obj.pop("schema", None)
        if "additionalItems" not in obj and "additional_items" in obj:
            obj["additionalItems"] = obj["additional_items"]
        obj.pop("additional_items", None)
        if "additionalProperties" not in obj and "additional_properties" in obj:
            obj["additionalProperties"] = obj["additional_properties"]
        obj.pop("additional_properties", None)
        if "allOf" not in obj and "all_of" in obj:
            obj["allOf"] = obj["all_of"]
        obj.pop("all_of", None)
        if "anyOf" not in obj and "any_of" in obj:
            obj["anyOf"] = obj["any_of"]
        obj.pop("any_of", None)
        if "exclusiveMaximum" not in obj and "exclusive_maximum" in obj:
            obj["exclusiveMaximum"] = obj["exclusive_maximum"]
        obj.pop("exclusive_maximum", None)
        if "exclusiveMinimum" not in obj and "exclusive_minimum" in obj:
            obj["exclusiveMinimum"] = obj["exclusive_minimum"]
        obj.pop("exclusive_minimum", None)
        if "externalDocs" not in obj and "external_docs" in obj:
            obj["externalDocs"] = obj["external_docs"]
        obj.pop("external_docs", None)
        if "maxItems" not in obj and "max_items" in obj:
            obj["maxItems"] = obj["max_items"]
        obj.pop("max_items", None)
        if "maxLength" not in obj and "max_length" in obj:
            obj["maxLength"] = obj["max_length"]
        obj.pop("max_length", None)
        if "maxProperties" not in obj and "max_properties" in obj:
            obj["maxProperties"] = obj["max_properties"]
        obj.pop("max_properties", None)
        if "minItems" not in obj and "min_items" in obj:
            obj["minItems"] = obj["min_items"]
        obj.pop("min_items", None)
        if "minLength" not in obj and "min_length" in obj:
            obj["minLength"] = obj["min_length"]
        obj.pop("min_length", None)
        if "minProperties" not in obj and "min_properties" in obj:
            obj["minProperties"] = obj["min_properties"]
        obj.pop("min_properties", None)
        if "multipleOf" not in obj and "multiple_of" in obj:
            obj["multipleOf"] = obj["multiple_of"]
        obj.pop("multiple_of", None)
        if (
            "not" in obj
            and "_not" in obj
        ):
            raise ValueError(
                "%s received both %r and %r"
                % (
                    cls.__name__,
                    "not",
                    "_not",
                )
            )
        if "not" not in obj and "_not" in obj:
            obj["not"] = obj["_not"]
        obj.pop("_not", None)
        if "oneOf" not in obj and "one_of" in obj:
            obj["oneOf"] = obj["one_of"]
        obj.pop("one_of", None)
        if "patternProperties" not in obj and "pattern_properties" in obj:
            obj["patternProperties"] = obj["pattern_properties"]
        obj.pop("pattern_properties", None)
        if "uniqueItems" not in obj and "unique_items" in obj:
            obj["uniqueItems"] = obj["unique_items"]
        obj.pop("unique_items", None)
        if "x-kubernetes-embedded-resource" not in obj and "x_kubernetes_embedded_resource" in obj:
            obj["x-kubernetes-embedded-resource"] = obj["x_kubernetes_embedded_resource"]
        obj.pop("x_kubernetes_embedded_resource", None)
        if "x-kubernetes-int-or-string" not in obj and "x_kubernetes_int_or_string" in obj:
            obj["x-kubernetes-int-or-string"] = obj["x_kubernetes_int_or_string"]
        obj.pop("x_kubernetes_int_or_string", None)
        if "x-kubernetes-list-map-keys" not in obj and "x_kubernetes_list_map_keys" in obj:
            obj["x-kubernetes-list-map-keys"] = obj["x_kubernetes_list_map_keys"]
        obj.pop("x_kubernetes_list_map_keys", None)
        if "x-kubernetes-list-type" not in obj and "x_kubernetes_list_type" in obj:
            obj["x-kubernetes-list-type"] = obj["x_kubernetes_list_type"]
        obj.pop("x_kubernetes_list_type", None)
        if "x-kubernetes-map-type" not in obj and "x_kubernetes_map_type" in obj:
            obj["x-kubernetes-map-type"] = obj["x_kubernetes_map_type"]
        obj.pop("x_kubernetes_map_type", None)
        if "x-kubernetes-preserve-unknown-fields" not in obj and "x_kubernetes_preserve_unknown_fields" in obj:
            obj["x-kubernetes-preserve-unknown-fields"] = obj["x_kubernetes_preserve_unknown_fields"]
        obj.pop("x_kubernetes_preserve_unknown_fields", None)
        if "x-kubernetes-validations" not in obj and "x_kubernetes_validations" in obj:
            obj["x-kubernetes-validations"] = obj["x_kubernetes_validations"]
        obj.pop("x_kubernetes_validations", None)
        if remove_hidden_storage_names:
            obj.pop("var_schema", None)
            obj.pop("var_not", None)
        return obj

    # Pydantic passes the model instance to wrap validators during assignment:
    # https://docs.pydantic.dev/2.11/migration/#changes-to-validators
    # Private names also keep inherited model validators distinct:
    # https://docs.pydantic.dev/2.11/concepts/validators/#on-inheritance
    @_model_validator(mode="wrap")
    @classmethod
    def __validate_input_names(
        cls,
        obj: Any,
        handler: _ModelWrapValidatorHandler[Self],
    ) -> Self:
        if not isinstance(obj, cls):
            obj = cls.__preprocess_input_names(obj)
        return handler(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, V1JSONSchemaProps):
            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, V1JSONSchemaProps):
            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 V1JSONSchemaProps 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 {
            ("$ref" if serialize else "ref"): _to_legacy_value(getattr(self, "ref", None), serialize),
            ("$schema" if serialize else "schema"): _to_legacy_value(getattr(self, "var_schema", None), serialize),
            ("additionalItems" if serialize else "additional_items"): _to_legacy_value(getattr(self, "additional_items", None), serialize),
            ("additionalProperties" if serialize else "additional_properties"): _to_legacy_value(getattr(self, "additional_properties", None), serialize),
            ("allOf" if serialize else "all_of"): _to_legacy_value(getattr(self, "all_of", None), serialize),
            ("anyOf" if serialize else "any_of"): _to_legacy_value(getattr(self, "any_of", None), serialize),
            ("default" if serialize else "default"): _to_legacy_value(getattr(self, "default", None), serialize),
            ("definitions" if serialize else "definitions"): _to_legacy_value(getattr(self, "definitions", None), serialize),
            ("dependencies" if serialize else "dependencies"): _to_legacy_value(getattr(self, "dependencies", None), serialize),
            ("description" if serialize else "description"): _to_legacy_value(getattr(self, "description", None), serialize),
            ("enum" if serialize else "enum"): _to_legacy_value(getattr(self, "enum", None), serialize),
            ("example" if serialize else "example"): _to_legacy_value(getattr(self, "example", None), serialize),
            ("exclusiveMaximum" if serialize else "exclusive_maximum"): _to_legacy_value(getattr(self, "exclusive_maximum", None), serialize),
            ("exclusiveMinimum" if serialize else "exclusive_minimum"): _to_legacy_value(getattr(self, "exclusive_minimum", None), serialize),
            ("externalDocs" if serialize else "external_docs"): _to_legacy_value(getattr(self, "external_docs", None), serialize),
            ("format" if serialize else "format"): _to_legacy_value(getattr(self, "format", None), serialize),
            ("id" if serialize else "id"): _to_legacy_value(getattr(self, "id", None), serialize),
            ("items" if serialize else "items"): _to_legacy_value(getattr(self, "items", None), serialize),
            ("maxItems" if serialize else "max_items"): _to_legacy_value(getattr(self, "max_items", None), serialize),
            ("maxLength" if serialize else "max_length"): _to_legacy_value(getattr(self, "max_length", None), serialize),
            ("maxProperties" if serialize else "max_properties"): _to_legacy_value(getattr(self, "max_properties", None), serialize),
            ("maximum" if serialize else "maximum"): _to_legacy_value(getattr(self, "maximum", None), serialize),
            ("minItems" if serialize else "min_items"): _to_legacy_value(getattr(self, "min_items", None), serialize),
            ("minLength" if serialize else "min_length"): _to_legacy_value(getattr(self, "min_length", None), serialize),
            ("minProperties" if serialize else "min_properties"): _to_legacy_value(getattr(self, "min_properties", None), serialize),
            ("minimum" if serialize else "minimum"): _to_legacy_value(getattr(self, "minimum", None), serialize),
            ("multipleOf" if serialize else "multiple_of"): _to_legacy_value(getattr(self, "multiple_of", None), serialize),
            ("not" if serialize else "_not"): _to_legacy_value(getattr(self, "var_not", None), serialize),
            ("nullable" if serialize else "nullable"): _to_legacy_value(getattr(self, "nullable", None), serialize),
            ("oneOf" if serialize else "one_of"): _to_legacy_value(getattr(self, "one_of", None), serialize),
            ("pattern" if serialize else "pattern"): _to_legacy_value(getattr(self, "pattern", None), serialize),
            ("patternProperties" if serialize else "pattern_properties"): _to_legacy_value(getattr(self, "pattern_properties", None), serialize),
            ("properties" if serialize else "properties"): _to_legacy_value(getattr(self, "properties", None), serialize),
            ("required" if serialize else "required"): _to_legacy_value(getattr(self, "required", None), serialize),
            ("title" if serialize else "title"): _to_legacy_value(getattr(self, "title", None), serialize),
            ("type" if serialize else "type"): _to_legacy_value(getattr(self, "type", None), serialize),
            ("uniqueItems" if serialize else "unique_items"): _to_legacy_value(getattr(self, "unique_items", None), serialize),
            ("x-kubernetes-embedded-resource" if serialize else "x_kubernetes_embedded_resource"): _to_legacy_value(getattr(self, "x_kubernetes_embedded_resource", None), serialize),
            ("x-kubernetes-int-or-string" if serialize else "x_kubernetes_int_or_string"): _to_legacy_value(getattr(self, "x_kubernetes_int_or_string", None), serialize),
            ("x-kubernetes-list-map-keys" if serialize else "x_kubernetes_list_map_keys"): _to_legacy_value(getattr(self, "x_kubernetes_list_map_keys", None), serialize),
            ("x-kubernetes-list-type" if serialize else "x_kubernetes_list_type"): _to_legacy_value(getattr(self, "x_kubernetes_list_type", None), serialize),
            ("x-kubernetes-map-type" if serialize else "x_kubernetes_map_type"): _to_legacy_value(getattr(self, "x_kubernetes_map_type", None), serialize),
            ("x-kubernetes-preserve-unknown-fields" if serialize else "x_kubernetes_preserve_unknown_fields"): _to_legacy_value(getattr(self, "x_kubernetes_preserve_unknown_fields", None), serialize),
            ("x-kubernetes-validations" if serialize else "x_kubernetes_validations"): _to_legacy_value(getattr(self, "x_kubernetes_validations", 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 all_of (list)
        _items = []
        if self.all_of:
            for _item_all_of in self.all_of:
                _items.append(_to_openapi_value(_item_all_of) if _item_all_of is not None else None)
            _dict['allOf'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in any_of (list)
        _items = []
        if self.any_of:
            for _item_any_of in self.any_of:
                _items.append(_to_openapi_value(_item_any_of) if _item_any_of is not None else None)
            _dict['anyOf'] = _items
        # override the default output from pydantic by calling `to_dict()` of each value in definitions (dict)
        _field_dict = {}
        if self.definitions:
            for _key_definitions in self.definitions:
                _field_dict[_key_definitions] = _to_openapi_value(self.definitions[_key_definitions]) if self.definitions[_key_definitions] is not None else None
            _dict['definitions'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of external_docs
        if self.external_docs:
            _dict['externalDocs'] = _to_openapi_value(self.external_docs)
        # override the default output from pydantic by calling `to_dict()` of var_not
        if self.var_not:
            _dict['not'] = _to_openapi_value(self.var_not)
        # override the default output from pydantic by calling `to_dict()` of each item in one_of (list)
        _items = []
        if self.one_of:
            for _item_one_of in self.one_of:
                _items.append(_to_openapi_value(_item_one_of) if _item_one_of is not None else None)
            _dict['oneOf'] = _items
        # override the default output from pydantic by calling `to_dict()` of each value in pattern_properties (dict)
        _field_dict = {}
        if self.pattern_properties:
            for _key_pattern_properties in self.pattern_properties:
                _field_dict[_key_pattern_properties] = _to_openapi_value(self.pattern_properties[_key_pattern_properties]) if self.pattern_properties[_key_pattern_properties] is not None else None
            _dict['patternProperties'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in properties (dict)
        _field_dict = {}
        if self.properties:
            for _key_properties in self.properties:
                _field_dict[_key_properties] = _to_openapi_value(self.properties[_key_properties]) if self.properties[_key_properties] is not None else None
            _dict['properties'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each item in x_kubernetes_validations (list)
        _items = []
        if self.x_kubernetes_validations:
            for _item_x_kubernetes_validations in self.x_kubernetes_validations:
                _items.append(_to_openapi_value(_item_x_kubernetes_validations) if _item_x_kubernetes_validations is not None else None)
            _dict['x-kubernetes-validations'] = _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 V1JSONSchemaProps 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({
            "$ref": obj.get("$ref"),
            "$schema": obj.get("$schema"),
            "additionalItems": obj.get("additionalItems"),
            "additionalProperties": obj.get("additionalProperties"),
            "allOf": [V1JSONSchemaProps.from_dict(_item) for _item in obj["allOf"]] if obj.get("allOf") is not None else None,
            "anyOf": [V1JSONSchemaProps.from_dict(_item) for _item in obj["anyOf"]] if obj.get("anyOf") is not None else None,
            "default": obj.get("default"),
            "definitions": dict(
                (_k, V1JSONSchemaProps.from_dict(_v))
                for _k, _v in obj["definitions"].items()
            )
            if obj.get("definitions") is not None
            else None,
            "dependencies": obj.get("dependencies"),
            "description": obj.get("description"),
            "enum": obj.get("enum"),
            "example": obj.get("example"),
            "exclusiveMaximum": obj.get("exclusiveMaximum"),
            "exclusiveMinimum": obj.get("exclusiveMinimum"),
            "externalDocs": V1ExternalDocumentation.from_dict(obj["externalDocs"]) if obj.get("externalDocs") is not None else None,
            "format": obj.get("format"),
            "id": obj.get("id"),
            "items": obj.get("items"),
            "maxItems": obj.get("maxItems"),
            "maxLength": obj.get("maxLength"),
            "maxProperties": obj.get("maxProperties"),
            "maximum": obj.get("maximum"),
            "minItems": obj.get("minItems"),
            "minLength": obj.get("minLength"),
            "minProperties": obj.get("minProperties"),
            "minimum": obj.get("minimum"),
            "multipleOf": obj.get("multipleOf"),
            "not": V1JSONSchemaProps.from_dict(obj["not"]) if obj.get("not") is not None else None,
            "nullable": obj.get("nullable"),
            "oneOf": [V1JSONSchemaProps.from_dict(_item) for _item in obj["oneOf"]] if obj.get("oneOf") is not None else None,
            "pattern": obj.get("pattern"),
            "patternProperties": dict(
                (_k, V1JSONSchemaProps.from_dict(_v))
                for _k, _v in obj["patternProperties"].items()
            )
            if obj.get("patternProperties") is not None
            else None,
            "properties": dict(
                (_k, V1JSONSchemaProps.from_dict(_v))
                for _k, _v in obj["properties"].items()
            )
            if obj.get("properties") is not None
            else None,
            "required": obj.get("required"),
            "title": obj.get("title"),
            "type": obj.get("type"),
            "uniqueItems": obj.get("uniqueItems"),
            "x-kubernetes-embedded-resource": obj.get("x-kubernetes-embedded-resource"),
            "x-kubernetes-int-or-string": obj.get("x-kubernetes-int-or-string"),
            "x-kubernetes-list-map-keys": obj.get("x-kubernetes-list-map-keys"),
            "x-kubernetes-list-type": obj.get("x-kubernetes-list-type"),
            "x-kubernetes-map-type": obj.get("x-kubernetes-map-type"),
            "x-kubernetes-preserve-unknown-fields": obj.get("x-kubernetes-preserve-unknown-fields"),
            "x-kubernetes-validations": [V1ValidationRule.from_dict(_item) for _item in obj["x-kubernetes-validations"]] if obj.get("x-kubernetes-validations") is not None else None
        })
        return _obj

    if TYPE_CHECKING:

        @property  # type: ignore[override]
        def schema(self) -> _V1JSONSchemaProps_var_schema_public_type:
            return self.var_schema

        @schema.setter
        def schema(self, value: _V1JSONSchemaProps_var_schema_public_type) -> None:  # pyright: ignore[reportIncompatibleMethodOverride]
            self.var_schema = value

        @property
        def _not(self) -> _V1JSONSchemaProps_var_not_public_type:
            return self.var_not

        @_not.setter
        def _not(self, value: _V1JSONSchemaProps_var_not_public_type) -> None:
            self.var_not = value

# TODO: Rewrite to not use raise_errors
V1JSONSchemaProps.model_rebuild(raise_errors=False)

if TYPE_CHECKING:
    _V1JSONSchemaProps_var_schema_public_type = Optional[StrictStr]
    _V1JSONSchemaProps_var_not_public_type = Optional[V1JSONSchemaProps]

# Install forwarding properties after Pydantic has consumed the class
# namespace and resolved any postponed model annotations.
setattr(
    V1JSONSchemaProps,
    "schema",
    property(
        lambda self: self.var_schema,
        lambda self, value: setattr(
            self,
            "var_schema",
            value,
        ),
    ),
)
setattr(
    V1JSONSchemaProps,
    "_not",
    property(
        lambda self: self.var_not,
        lambda self, value: setattr(
            self,
            "var_not",
            value,
        ),
    ),
)
