# generated by https://github.com/puzl-cloud/kubesdk
#   filename:  apis__autoscaling__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 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 CrossVersionObjectReference(LazyLoadModel):
    kind: str
    name: str
    apiVersion: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class HorizontalPodAutoscalerSpec(LazyLoadModel):
    maxReplicas: int
    scaleTargetRef: CrossVersionObjectReference
    minReplicas: int | None = None
    targetCPUUtilizationPercentage: int | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class HorizontalPodAutoscalerStatus(LazyLoadModel):
    currentReplicas: int
    desiredReplicas: int
    currentCPUUtilizationPercentage: int | None = None
    lastScaleTime: Time | None = None
    observedGeneration: int | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class HorizontalPodAutoscaler(K8sResource):
    apiVersion: ClassVar[str] = 'autoscaling/v1'
    kind: ClassVar[str] = 'HorizontalPodAutoscaler'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    spec: HorizontalPodAutoscalerSpec | None = None
    status: HorizontalPodAutoscalerStatus | None = None
    api_path_: ClassVar[str] = (
        'apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers'
    )
    plural_: ClassVar[str] = 'horizontalpodautoscalers'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'autoscaling'
    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 HorizontalPodAutoscalerList(LazyLoadModel):
    items: List[HorizontalPodAutoscaler]
    apiVersion: str = 'autoscaling/v1'
    kind: str = 'HorizontalPodAutoscalerList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
