# generated by https://github.com/puzl-cloud/kubesdk
#   filename:  apis__apiextensions.k8s.io__v1_openapi.json

from __future__ import annotations

from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Any, ClassVar, Dict, List, Set

from kube_models.const import *
from kube_models.loader import *
from kube_models.loader import LazyLoadModel
from kube_models.resource import *

from .....apimachinery.pkg.apis.meta.v1 import ListMeta, ObjectMeta, Time


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceColumnDefinition(LazyLoadModel):
    jsonPath: str
    name: str
    type: str
    description: str | None = None
    format: str | None = None
    priority: int | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinitionNames(LazyLoadModel):
    kind: str
    plural: str
    categories: List[str] | None = None
    listKind: str | None = None
    shortNames: List[str] | None = None
    singular: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceSubresourceScale(LazyLoadModel):
    specReplicasPath: str
    statusReplicasPath: str
    labelSelectorPath: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceSubresourceStatus(LazyLoadModel):
    pass


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceSubresources(LazyLoadModel):
    scale: CustomResourceSubresourceScale | None = None
    status: CustomResourceSubresourceStatus | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ExternalDocumentation(LazyLoadModel):
    description: str | None = None
    url: str | None = None


JSON = Any


JSONSchemaPropsOrArray = Any


JSONSchemaPropsOrBool = Any


JSONSchemaPropsOrStringArray = Any


@dataclass(slots=True, kw_only=True, frozen=True)
class SelectableField(LazyLoadModel):
    jsonPath: str


@dataclass(slots=True, kw_only=True, frozen=True)
class ServiceReference(LazyLoadModel):
    name: str
    namespace: str
    path: str | None = None
    port: int | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class ValidationRule(LazyLoadModel):
    rule: str
    fieldPath: str | None = None
    message: str | None = None
    messageExpression: str | None = None
    optionalOldSelf: bool | None = None
    reason: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class WebhookClientConfig(LazyLoadModel):
    caBundle: str | None = None
    service: ServiceReference | None = None
    url: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class WebhookConversion(LazyLoadModel):
    conversionReviewVersions: List[str]
    clientConfig: WebhookClientConfig | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceConversion(LazyLoadModel):
    strategy: str
    webhook: WebhookConversion | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinitionCondition(LazyLoadModel):
    status: str
    type: str
    lastTransitionTime: Time | None = None
    message: str | None = None
    reason: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinitionStatus(LazyLoadModel):
    acceptedNames: CustomResourceDefinitionNames | None = None
    conditions: List[CustomResourceDefinitionCondition] | None = None
    storedVersions: List[str] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class JSONSchemaProps(LazyLoadModel):
    field_ref: str | None = None
    field_schema: str | None = None
    additionalItems: JSONSchemaPropsOrBool | None = None
    additionalProperties: JSONSchemaPropsOrBool | None = None
    allOf: List[JSONSchemaProps] | None = None
    anyOf: List[JSONSchemaProps] | None = None
    default: JSON | None = None
    definitions: Dict[str, JSONSchemaProps] | None = None
    dependencies: Dict[str, JSONSchemaPropsOrStringArray] | None = None
    description: str | None = None
    enum: List[JSON] | None = None
    example: JSON | None = None
    exclusiveMaximum: bool | None = None
    exclusiveMinimum: bool | None = None
    externalDocs: ExternalDocumentation | None = None
    format: str | None = None
    id: str | None = None
    items: JSONSchemaPropsOrArray | None = None
    maxItems: int | None = None
    maxLength: int | None = None
    maxProperties: int | None = None
    maximum: float | None = None
    minItems: int | None = None
    minLength: int | None = None
    minProperties: int | None = None
    minimum: float | None = None
    multipleOf: float | None = None
    not_: JSONSchemaProps | None = None
    nullable: bool | None = None
    oneOf: List[JSONSchemaProps] | None = None
    pattern: str | None = None
    patternProperties: Dict[str, JSONSchemaProps] | None = None
    properties: Dict[str, JSONSchemaProps] | None = None
    required: List[str] | None = None
    title: str | None = None
    type: str | None = None
    uniqueItems: bool | None = None
    x_kubernetes_embedded_resource: bool | None = None
    x_kubernetes_int_or_string: bool | None = None
    x_kubernetes_list_map_keys: List[str] | None = None
    x_kubernetes_list_type: str | None = None
    x_kubernetes_map_type: str | None = None
    x_kubernetes_preserve_unknown_fields: bool | None = None
    x_kubernetes_validations: List[ValidationRule] | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceValidation(LazyLoadModel):
    openAPIV3Schema: JSONSchemaProps | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinitionVersion(LazyLoadModel):
    name: str
    served: bool
    storage: bool
    additionalPrinterColumns: List[CustomResourceColumnDefinition] | None = None
    deprecated: bool | None = None
    deprecationWarning: str | None = None
    schema_: CustomResourceValidation | None = None
    selectableFields: List[SelectableField] | None = None
    subresources: CustomResourceSubresources | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinitionSpec(LazyLoadModel):
    group: str
    names: CustomResourceDefinitionNames
    scope: str
    versions: List[CustomResourceDefinitionVersion]
    conversion: CustomResourceConversion | None = None
    preserveUnknownFields: bool | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinition(K8sResource):
    spec: CustomResourceDefinitionSpec
    apiVersion: ClassVar[str] = 'apiextensions.k8s.io/v1'
    kind: ClassVar[str] = 'CustomResourceDefinition'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    status: CustomResourceDefinitionStatus | None = None
    api_path_: ClassVar[str] = 'apis/apiextensions.k8s.io/v1/customresourcedefinitions'
    plural_: ClassVar[str] = 'customresourcedefinitions'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'apiextensions.k8s.io'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        'application/apply-patch+cbor',
        'application/apply-patch+yaml',
        'application/json-patch+json',
        'application/merge-patch+json',
        'application/strategic-merge-patch+json',
    }


@dataclass(slots=True, kw_only=True, frozen=True)
class CustomResourceDefinitionList(LazyLoadModel):
    items: List[CustomResourceDefinition]
    apiVersion: str = 'apiextensions.k8s.io/v1'
    kind: str = 'CustomResourceDefinitionList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
