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

from __future__ import annotations

from typing import Annotated, Callable, List, Literal, Optional, Type, Union

from pydantic import Field

from cloudcoil import apimachinery
from cloudcoil.pydantic import BaseBuilder, BaseModel, GenericListBuilder, Self
from cloudcoil.resources import Resource, ResourceList

from ..core import v1


class PodSchedulingContextSpec(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["PodSchedulingContextSpec"]:
            return PodSchedulingContextSpec

        def build(self) -> "PodSchedulingContextSpec":
            return PodSchedulingContextSpec(**self._attrs)

        def potential_nodes(self, value: Optional[List[str]]) -> Self:
            return self._set("potential_nodes", value)

        def selected_node(self, value: Optional[str]) -> Self:
            return self._set("selected_node", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["PodSchedulingContextSpec", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodSchedulingContextSpec.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    potential_nodes: Annotated[
        Optional[List[str]],
        Field(
            alias="potentialNodes",
            description="PotentialNodes lists nodes where the Pod might be able to run.\n\nThe size of this field is limited to 128. This is large enough for many clusters. Larger clusters may need more attempts to find a node that suits all pending resources. This may get increased in the future, but not reduced.",
        ),
    ] = None
    selected_node: Annotated[
        Optional[str],
        Field(
            alias="selectedNode",
            description='SelectedNode is the node for which allocation of ResourceClaims that are referenced by the Pod and that use "WaitForFirstConsumer" allocation is to be attempted.',
        ),
    ] = None


class ResourceClaimConsumerReference(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimConsumerReference"]:
            return ResourceClaimConsumerReference

        def build(self) -> "ResourceClaimConsumerReference":
            return ResourceClaimConsumerReference(**self._attrs)

        def api_group(self, value: Optional[str]) -> Self:
            return self._set("api_group", value)

        def name(self, value: str) -> Self:
            return self._set("name", value)

        def resource(self, value: str) -> Self:
            return self._set("resource", value)

        def uid(self, value: str) -> Self:
            return self._set("uid", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimConsumerReference", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimConsumerReference.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_group: Annotated[
        Optional[str],
        Field(
            alias="apiGroup",
            description="APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources.",
        ),
    ] = None
    name: Annotated[str, Field(description="Name is the name of resource being referenced.")]
    resource: Annotated[
        str,
        Field(description='Resource is the type of resource being referenced, for example "pods".'),
    ]
    uid: Annotated[
        str,
        Field(description="UID identifies exactly one incarnation of the resource."),
    ]


class ResourceClaimParametersReference(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimParametersReference"]:
            return ResourceClaimParametersReference

        def build(self) -> "ResourceClaimParametersReference":
            return ResourceClaimParametersReference(**self._attrs)

        def api_group(self, value: Optional[str]) -> Self:
            return self._set("api_group", value)

        def kind(self, value: str) -> Self:
            return self._set("kind", value)

        def name(self, value: str) -> Self:
            return self._set("name", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimParametersReference", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimParametersReference.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_group: Annotated[
        Optional[str],
        Field(
            alias="apiGroup",
            description="APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources.",
        ),
    ] = None
    kind: Annotated[
        str,
        Field(
            description='Kind is the type of resource being referenced. This is the same value as in the parameter object\'s metadata, for example "ConfigMap".'
        ),
    ]
    name: Annotated[str, Field(description="Name is the name of resource being referenced.")]


class ResourceClaimSchedulingStatus(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimSchedulingStatus"]:
            return ResourceClaimSchedulingStatus

        def build(self) -> "ResourceClaimSchedulingStatus":
            return ResourceClaimSchedulingStatus(**self._attrs)

        def name(self, value: Optional[str]) -> Self:
            return self._set("name", value)

        def unsuitable_nodes(self, value: Optional[List[str]]) -> Self:
            return self._set("unsuitable_nodes", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimSchedulingStatus", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimSchedulingStatus.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    name: Annotated[
        Optional[str],
        Field(description="Name matches the pod.spec.resourceClaims[*].Name field."),
    ] = None
    unsuitable_nodes: Annotated[
        Optional[List[str]],
        Field(
            alias="unsuitableNodes",
            description="UnsuitableNodes lists nodes that the ResourceClaim cannot be allocated for.\n\nThe size of this field is limited to 128, the same as for PodSchedulingSpec.PotentialNodes. This may get increased in the future, but not reduced.",
        ),
    ] = None


class ResourceClaimSpec(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimSpec"]:
            return ResourceClaimSpec

        def build(self) -> "ResourceClaimSpec":
            return ResourceClaimSpec(**self._attrs)

        def allocation_mode(self, value: Optional[str]) -> Self:
            return self._set("allocation_mode", value)

        """  """

        def parameters_ref(
            self,
            value_or_callback: Union[
                Optional[ResourceClaimParametersReference],
                Callable[
                    [ResourceClaimParametersReference.Builder],
                    ResourceClaimParametersReference.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimParametersReference.builder()).build()
            return self._set("parameters_ref", value)

        def resource_class_name(self, value: str) -> Self:
            return self._set("resource_class_name", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimSpec", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimSpec.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    allocation_mode: Annotated[
        Optional[str],
        Field(
            alias="allocationMode",
            description='Allocation can start immediately or when a Pod wants to use the resource. "WaitForFirstConsumer" is the default.',
        ),
    ] = None
    parameters_ref: Annotated[
        Optional[ResourceClaimParametersReference],
        Field(
            alias="parametersRef",
            description="ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim.\n\nThe object must be in the same namespace as the ResourceClaim.",
        ),
    ] = None
    resource_class_name: Annotated[
        str,
        Field(
            alias="resourceClassName",
            description="ResourceClassName references the driver and additional parameters via the name of a ResourceClass that was created as part of the driver deployment.",
        ),
    ]


class ResourceClassParametersReference(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClassParametersReference"]:
            return ResourceClassParametersReference

        def build(self) -> "ResourceClassParametersReference":
            return ResourceClassParametersReference(**self._attrs)

        def api_group(self, value: Optional[str]) -> Self:
            return self._set("api_group", value)

        def kind(self, value: str) -> Self:
            return self._set("kind", value)

        def name(self, value: str) -> Self:
            return self._set("name", value)

        def namespace(self, value: Optional[str]) -> Self:
            return self._set("namespace", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClassParametersReference", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClassParametersReference.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_group: Annotated[
        Optional[str],
        Field(
            alias="apiGroup",
            description="APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources.",
        ),
    ] = None
    kind: Annotated[
        str,
        Field(
            description="Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata."
        ),
    ]
    name: Annotated[str, Field(description="Name is the name of resource being referenced.")]
    namespace: Annotated[
        Optional[str],
        Field(
            description="Namespace that contains the referenced resource. Must be empty for cluster-scoped resources and non-empty for namespaced resources."
        ),
    ] = None


class ResourceHandle(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceHandle"]:
            return ResourceHandle

        def build(self) -> "ResourceHandle":
            return ResourceHandle(**self._attrs)

        def data(self, value: Optional[str]) -> Self:
            return self._set("data", value)

        def driver_name(self, value: Optional[str]) -> Self:
            return self._set("driver_name", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceHandle", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceHandle.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    data: Annotated[
        Optional[str],
        Field(
            description="Data contains the opaque data associated with this ResourceHandle. It is set by the controller component of the resource driver whose name matches the DriverName set in the ResourceClaimStatus this ResourceHandle is embedded in. It is set at allocation time and is intended for processing by the kubelet plugin whose name matches the DriverName set in this ResourceHandle.\n\nThe maximum size of this field is 16KiB. This may get increased in the future, but not reduced."
        ),
    ] = None
    driver_name: Annotated[
        Optional[str],
        Field(
            alias="driverName",
            description="DriverName specifies the name of the resource driver whose kubelet plugin should be invoked to process this ResourceHandle's data once it lands on a node. This may differ from the DriverName set in ResourceClaimStatus this ResourceHandle is embedded in.",
        ),
    ] = None


class AllocationResult(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["AllocationResult"]:
            return AllocationResult

        def build(self) -> "AllocationResult":
            return AllocationResult(**self._attrs)

        """  """

        def available_on_nodes(
            self,
            value_or_callback: Union[
                Optional[v1.NodeSelector],
                Callable[[v1.NodeSelector.Builder], v1.NodeSelector.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(v1.NodeSelector.builder()).build()
            return self._set("available_on_nodes", value)

        """  """

        def resource_handles(
            self,
            value_or_callback: Union[
                Optional[List[ResourceHandle]],
                Callable[
                    [GenericListBuilder[ResourceHandle, ResourceHandle.Builder]],
                    GenericListBuilder[ResourceHandle, ResourceHandle.Builder],
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceHandle.list_builder()).build()
            return self._set("resource_handles", value)

        def shareable(self, value: Optional[bool]) -> Self:
            return self._set("shareable", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["AllocationResult", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use AllocationResult.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    available_on_nodes: Annotated[
        Optional[v1.NodeSelector],
        Field(
            alias="availableOnNodes",
            description="This field will get set by the resource driver after it has allocated the resource to inform the scheduler where it can schedule Pods using the ResourceClaim.\n\nSetting this field is optional. If null, the resource is available everywhere.",
        ),
    ] = None
    resource_handles: Annotated[
        Optional[List[ResourceHandle]],
        Field(
            alias="resourceHandles",
            description="ResourceHandles contain the state associated with an allocation that should be maintained throughout the lifetime of a claim. Each ResourceHandle contains data that should be passed to a specific kubelet plugin once it lands on a node. This data is returned by the driver after a successful allocation and is opaque to Kubernetes. Driver documentation may explain to users how to interpret this data if needed.\n\nSetting this field is optional. It has a maximum size of 32 entries. If null (or empty), it is assumed this allocation will be processed by a single kubelet plugin with no ResourceHandle data attached. The name of the kubelet plugin invoked will match the DriverName set in the ResourceClaimStatus this AllocationResult is embedded in.",
        ),
    ] = None
    shareable: Annotated[
        Optional[bool],
        Field(
            description="Shareable determines whether the resource supports more than one consumer at a time."
        ),
    ] = None


class PodSchedulingContextStatus(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["PodSchedulingContextStatus"]:
            return PodSchedulingContextStatus

        def build(self) -> "PodSchedulingContextStatus":
            return PodSchedulingContextStatus(**self._attrs)

        """  """

        def resource_claims(
            self,
            value_or_callback: Union[
                Optional[List[ResourceClaimSchedulingStatus]],
                Callable[
                    [
                        GenericListBuilder[
                            ResourceClaimSchedulingStatus,
                            ResourceClaimSchedulingStatus.Builder,
                        ]
                    ],
                    GenericListBuilder[
                        ResourceClaimSchedulingStatus,
                        ResourceClaimSchedulingStatus.Builder,
                    ],
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimSchedulingStatus.list_builder()).build()
            return self._set("resource_claims", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["PodSchedulingContextStatus", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodSchedulingContextStatus.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    resource_claims: Annotated[
        Optional[List[ResourceClaimSchedulingStatus]],
        Field(
            alias="resourceClaims",
            description='ResourceClaims describes resource availability for each pod.spec.resourceClaim entry where the corresponding ResourceClaim uses "WaitForFirstConsumer" allocation mode.',
        ),
    ] = None


class ResourceClaimStatus(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimStatus"]:
            return ResourceClaimStatus

        def build(self) -> "ResourceClaimStatus":
            return ResourceClaimStatus(**self._attrs)

        """  """

        def allocation(
            self,
            value_or_callback: Union[
                Optional[AllocationResult],
                Callable[[AllocationResult.Builder], AllocationResult.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(AllocationResult.builder()).build()
            return self._set("allocation", value)

        def deallocation_requested(self, value: Optional[bool]) -> Self:
            return self._set("deallocation_requested", value)

        def driver_name(self, value: Optional[str]) -> Self:
            return self._set("driver_name", value)

        """  """

        def reserved_for(
            self,
            value_or_callback: Union[
                Optional[List[ResourceClaimConsumerReference]],
                Callable[
                    [
                        GenericListBuilder[
                            ResourceClaimConsumerReference,
                            ResourceClaimConsumerReference.Builder,
                        ]
                    ],
                    GenericListBuilder[
                        ResourceClaimConsumerReference,
                        ResourceClaimConsumerReference.Builder,
                    ],
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimConsumerReference.list_builder()).build()
            return self._set("reserved_for", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimStatus", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimStatus.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    allocation: Annotated[
        Optional[AllocationResult],
        Field(
            description="Allocation is set by the resource driver once a resource or set of resources has been allocated successfully. If this is not specified, the resources have not been allocated yet."
        ),
    ] = None
    deallocation_requested: Annotated[
        Optional[bool],
        Field(
            alias="deallocationRequested",
            description="DeallocationRequested indicates that a ResourceClaim is to be deallocated.\n\nThe driver then must deallocate this claim and reset the field together with clearing the Allocation field.\n\nWhile DeallocationRequested is set, no new consumers may be added to ReservedFor.",
        ),
    ] = None
    driver_name: Annotated[
        Optional[str],
        Field(
            alias="driverName",
            description="DriverName is a copy of the driver name from the ResourceClass at the time when allocation started.",
        ),
    ] = None
    reserved_for: Annotated[
        Optional[List[ResourceClaimConsumerReference]],
        Field(
            alias="reservedFor",
            description="ReservedFor indicates which entities are currently allowed to use the claim. A Pod which references a ResourceClaim which is not reserved for that Pod will not be started.\n\nThere can be at most 32 such reservations. This may get increased in the future, but not reduced.",
        ),
    ] = None


class PodSchedulingContext(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["PodSchedulingContext"]:
            return PodSchedulingContext

        def build(self) -> "PodSchedulingContext":
            return PodSchedulingContext(**self._attrs)

        def api_version(self, value: Optional[Literal["resource.k8s.io/v1alpha2"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["PodSchedulingContext"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                PodSchedulingContextSpec,
                Callable[[PodSchedulingContextSpec.Builder], PodSchedulingContextSpec.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(PodSchedulingContextSpec.builder()).build()
            return self._set("spec", value)

        """  """

        def status(
            self,
            value_or_callback: Union[
                Optional[PodSchedulingContextStatus],
                Callable[
                    [PodSchedulingContextStatus.Builder],
                    PodSchedulingContextStatus.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(PodSchedulingContextStatus.builder()).build()
            return self._set("status", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["PodSchedulingContext", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use PodSchedulingContext.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_version: Annotated[
        Optional[Literal["resource.k8s.io/v1alpha2"]],
        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",
        ),
    ] = "resource.k8s.io/v1alpha2"
    kind: Annotated[
        Optional[Literal["PodSchedulingContext"]],
        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"
        ),
    ] = "PodSchedulingContext"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta], Field(description="Standard object metadata")
    ] = None
    spec: Annotated[
        PodSchedulingContextSpec,
        Field(description="Spec describes where resources for the Pod are needed."),
    ]
    status: Annotated[
        Optional[PodSchedulingContextStatus],
        Field(description="Status describes where resources for the Pod can be allocated."),
    ] = None


PodSchedulingContextList = ResourceList["PodSchedulingContext"]


class ResourceClaim(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaim"]:
            return ResourceClaim

        def build(self) -> "ResourceClaim":
            return ResourceClaim(**self._attrs)

        def api_version(self, value: Optional[Literal["resource.k8s.io/v1alpha2"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["ResourceClaim"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                ResourceClaimSpec,
                Callable[[ResourceClaimSpec.Builder], ResourceClaimSpec.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimSpec.builder()).build()
            return self._set("spec", value)

        """  """

        def status(
            self,
            value_or_callback: Union[
                Optional[ResourceClaimStatus],
                Callable[[ResourceClaimStatus.Builder], ResourceClaimStatus.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimStatus.builder()).build()
            return self._set("status", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaim", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaim.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_version: Annotated[
        Optional[Literal["resource.k8s.io/v1alpha2"]],
        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",
        ),
    ] = "resource.k8s.io/v1alpha2"
    kind: Annotated[
        Optional[Literal["ResourceClaim"]],
        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"
        ),
    ] = "ResourceClaim"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta], Field(description="Standard object metadata")
    ] = None
    spec: Annotated[
        ResourceClaimSpec,
        Field(
            description="Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim."
        ),
    ]
    status: Annotated[
        Optional[ResourceClaimStatus],
        Field(
            description="Status describes whether the resource is available and with which attributes."
        ),
    ] = None


ResourceClaimList = ResourceList["ResourceClaim"]


class ResourceClaimTemplateSpec(BaseModel):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimTemplateSpec"]:
            return ResourceClaimTemplateSpec

        def build(self) -> "ResourceClaimTemplateSpec":
            return ResourceClaimTemplateSpec(**self._attrs)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                ResourceClaimSpec,
                Callable[[ResourceClaimSpec.Builder], ResourceClaimSpec.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimSpec.builder()).build()
            return self._set("spec", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimTemplateSpec", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimTemplateSpec.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="ObjectMeta may contain labels and annotations that will be copied into the PVC when creating it. No other fields are allowed and will be rejected during validation."
        ),
    ] = None
    spec: Annotated[
        ResourceClaimSpec,
        Field(
            description="Spec for the ResourceClaim. The entire content is copied unchanged into the ResourceClaim that gets created from this template. The same fields as in a ResourceClaim are also valid here."
        ),
    ]


class ResourceClass(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClass"]:
            return ResourceClass

        def build(self) -> "ResourceClass":
            return ResourceClass(**self._attrs)

        def api_version(self, value: Optional[Literal["resource.k8s.io/v1alpha2"]]) -> Self:
            return self._set("api_version", value)

        def driver_name(self, value: str) -> Self:
            return self._set("driver_name", value)

        def kind(self, value: Optional[Literal["ResourceClass"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def parameters_ref(
            self,
            value_or_callback: Union[
                Optional[ResourceClassParametersReference],
                Callable[
                    [ResourceClassParametersReference.Builder],
                    ResourceClassParametersReference.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClassParametersReference.builder()).build()
            return self._set("parameters_ref", value)

        """  """

        def suitable_nodes(
            self,
            value_or_callback: Union[
                Optional[v1.NodeSelector],
                Callable[[v1.NodeSelector.Builder], v1.NodeSelector.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(v1.NodeSelector.builder()).build()
            return self._set("suitable_nodes", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClass", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClass.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_version: Annotated[
        Optional[Literal["resource.k8s.io/v1alpha2"]],
        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",
        ),
    ] = "resource.k8s.io/v1alpha2"
    driver_name: Annotated[
        str,
        Field(
            alias="driverName",
            description="DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.\n\nResource drivers have a unique name in forward domain order (acme.example.com).",
        ),
    ]
    kind: Annotated[
        Optional[Literal["ResourceClass"]],
        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"
        ),
    ] = "ResourceClass"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta], Field(description="Standard object metadata")
    ] = None
    parameters_ref: Annotated[
        Optional[ResourceClassParametersReference],
        Field(
            alias="parametersRef",
            description="ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec.",
        ),
    ] = None
    suitable_nodes: Annotated[
        Optional[v1.NodeSelector],
        Field(
            alias="suitableNodes",
            description="Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet.\n\nSetting this field is optional. If null, all nodes are candidates.",
        ),
    ] = None


ResourceClassList = ResourceList["ResourceClass"]


class ResourceClaimTemplate(Resource):
    class Builder(BaseBuilder):
        @property
        def base_class(self) -> Type["ResourceClaimTemplate"]:
            return ResourceClaimTemplate

        def build(self) -> "ResourceClaimTemplate":
            return ResourceClaimTemplate(**self._attrs)

        def api_version(self, value: Optional[Literal["resource.k8s.io/v1alpha2"]]) -> Self:
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["ResourceClaimTemplate"]]) -> Self:
            return self._set("kind", value)

        """  """

        def metadata(
            self,
            value_or_callback: Union[
                Optional[apimachinery.ObjectMeta],
                Callable[[apimachinery.ObjectMeta.Builder], apimachinery.ObjectMeta.Builder],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(apimachinery.ObjectMeta.builder()).build()
            return self._set("metadata", value)

        """  """

        def spec(
            self,
            value_or_callback: Union[
                ResourceClaimTemplateSpec,
                Callable[
                    [ResourceClaimTemplateSpec.Builder],
                    ResourceClaimTemplateSpec.Builder,
                ],
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(ResourceClaimTemplateSpec.builder()).build()
            return self._set("spec", value)

    @classmethod
    def builder(cls) -> Builder:
        return cls.Builder()

    class ListBuilder(GenericListBuilder["ResourceClaimTemplate", Builder]):
        def __init__(self):
            raise NotImplementedError(
                "This class is not meant to be instantiated. Use ResourceClaimTemplate.list_builder() instead."
            )

    @classmethod
    def list_builder(cls) -> ListBuilder:
        return GenericListBuilder[cls, cls.Builder]()  # type: ignore

    api_version: Annotated[
        Optional[Literal["resource.k8s.io/v1alpha2"]],
        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",
        ),
    ] = "resource.k8s.io/v1alpha2"
    kind: Annotated[
        Optional[Literal["ResourceClaimTemplate"]],
        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"
        ),
    ] = "ResourceClaimTemplate"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta], Field(description="Standard object metadata")
    ] = None
    spec: Annotated[
        ResourceClaimTemplateSpec,
        Field(
            description="Describes the ResourceClaim that is to be generated.\n\nThis field is immutable. A ResourceClaim will get created by the control plane for a Pod when needed and then not get updated anymore."
        ),
    ]


ResourceClaimTemplateList = ResourceList["ResourceClaimTemplate"]
