# generated by https://github.com/puzl-cloud/kubesdk
#   filename:  apis__batch__v1beta1_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
from ..core.v1 import ObjectReference
from .v1 import JobSpec


@dataclass(slots=True, kw_only=True, frozen=True)
class CronJobStatus(LazyLoadModel):
    active: List[ObjectReference] | None = None
    lastScheduleTime: Time | None = None
    lastSuccessfulTime: Time | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class JobTemplateSpec(LazyLoadModel):
    metadata: ObjectMeta | None = None
    spec: JobSpec | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CronJobSpec(LazyLoadModel):
    jobTemplate: JobTemplateSpec
    schedule: str
    concurrencyPolicy: str | None = None
    failedJobsHistoryLimit: int | None = None
    startingDeadlineSeconds: int | None = None
    successfulJobsHistoryLimit: int | None = None
    suspend: bool | None = None
    timeZone: str | None = None


@dataclass(slots=True, kw_only=True, frozen=True)
class CronJob(K8sResource):
    apiVersion: ClassVar[str] = 'batch/v1beta1'
    kind: ClassVar[str] = 'CronJob'
    metadata: ObjectMeta = field(default_factory=ObjectMeta)
    spec: CronJobSpec | None = None
    status: CronJobStatus | None = None
    api_path_: ClassVar[str] = 'apis/batch/v1beta1/namespaces/{namespace}/cronjobs'
    plural_: ClassVar[str] = 'cronjobs'
    is_namespaced_: ClassVar[bool] = False
    group_: ClassVar[Optional[str]] = 'batch'
    patch_strategies_: ClassVar[set[PatchRequestType]] = {
        '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 CronJobList(LazyLoadModel):
    items: List[CronJob]
    apiVersion: str = 'batch/v1beta1'
    kind: str = 'CronJobList'
    metadata: ListMeta = field(default_factory=ObjectMeta)
