# Generated by cloudcoil-model-codegen v0.0.16
# DO NOT EDIT

from __future__ import annotations

from typing import Annotated, Literal, Optional

from pydantic import Field

from cloudcoil import apimachinery
from cloudcoil._pydantic import BaseModel
from cloudcoil.resources import Resource, ResourceList


class LeaseSpec(BaseModel):
    acquire_time: Annotated[
        Optional[apimachinery.MicroTime],
        Field(
            alias="acquireTime",
            description="acquireTime is a time when the current lease was acquired.",
        ),
    ] = None
    holder_identity: Annotated[
        Optional[str],
        Field(
            alias="holderIdentity",
            description="holderIdentity contains the identity of the holder of a current lease.",
        ),
    ] = None
    lease_duration_seconds: Annotated[
        Optional[int],
        Field(
            alias="leaseDurationSeconds",
            description="leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. This is measure against time of last observed renewTime.",
        ),
    ] = None
    lease_transitions: Annotated[
        Optional[int],
        Field(
            alias="leaseTransitions",
            description="leaseTransitions is the number of transitions of a lease between holders.",
        ),
    ] = None
    renew_time: Annotated[
        Optional[apimachinery.MicroTime],
        Field(
            alias="renewTime",
            description="renewTime is a time when the current holder of a lease has last updated the lease.",
        ),
    ] = None


class Lease(Resource):
    api_version: Annotated[
        Optional[Literal["coordination.k8s.io/v1"]],
        Field(
            alias="apiVersion",
            description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
        ),
    ] = "coordination.k8s.io/v1"
    kind: Annotated[
        Optional[Literal["Lease"]],
        Field(
            description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
        ),
    ] = "Lease"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    spec: Annotated[
        Optional[LeaseSpec],
        Field(
            description="spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status"
        ),
    ] = None


LeaseList = ResourceList["Lease"]
