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

from __future__ import annotations

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

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

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


@dataclass(slots=True, kw_only=True, frozen=True)
class APIServiceCondition(Loadable):
    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 APIServiceStatus(Loadable):
    conditions: List[APIServiceCondition] = field(
        default_factory=list,
        metadata={
            'x-kubernetes-patch-strategy': 'merge',
            'x-kubernetes-patch-merge-key': 'type',
        },
    )


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


@dataclass(slots=True, kw_only=True, frozen=True)
class APIServiceSpec(Loadable):
    groupPriorityMinimum: int
    versionPriority: int
    caBundle: str | None = None
    group: str | None = None
    insecureSkipTLSVerify: bool | None = None
    service: ServiceReference | None = None
    version: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class APIService(K8sResource):
    apiVersion: ClassVar[str] = 'apiregistration.k8s.io/v1'
    kind: ClassVar[str] = 'APIService'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    spec: APIServiceSpec | None = None
    status: APIServiceStatus | None = None
    plural_: ClassVar[str] = 'apiservices'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'apiregistration.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 APIServiceList(Loadable):
    items: List[APIService]
    apiVersion: str = 'apiregistration.k8s.io/v1'
    kind: str = 'APIServiceList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
