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

from __future__ import annotations

from typing import (
    Annotated,
    Callable,
    List,
    Literal,
    Optional,
    Type,
    overload,
)

from pydantic import Field

from cloudcoil import apimachinery
from cloudcoil.pydantic import (
    BaseModel,
    BaseModelBuilder,
    BuilderContextBase,
    GenericListBuilder,
    ListBuilderContext,
    Never,
    Self,
)
from cloudcoil.resources import Resource, ResourceList

from ..core import v1


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

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

        def potential_nodes(self, value: Optional[List[str]], /) -> Self:
            """
            PotentialNodes lists nodes where the Pod might be able to run.

            The 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.
            """
            return self._set("potential_nodes", value)

        def selected_node(self, value: Optional[str], /) -> Self:
            """
            SelectedNode is the node for which allocation of ResourceClaims that are referenced by the Pod and that use "WaitForFirstConsumer" allocation is to be attempted.
            """
            return self._set("selected_node", value)

    class BuilderContext(BuilderContextBase["PodSchedulingContextSpec.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodSchedulingContextSpec.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodSchedulingContextSpec."""
        return cls.BuilderContext()

    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")] = None
    """
    PotentialNodes lists nodes where the Pod might be able to run.

    The 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.
    """
    selected_node: Annotated[Optional[str], Field(alias="selectedNode")] = None
    """
    SelectedNode is the node for which allocation of ResourceClaims that are referenced by the Pod and that use "WaitForFirstConsumer" allocation is to be attempted.
    """


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

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

        def api_group(self, value: Optional[str], /) -> Self:
            """
            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.
            """
            return self._set("api_group", value)

        def name(self, value: str, /) -> Self:
            """
            Name is the name of resource being referenced.
            """
            return self._set("name", value)

        def resource(self, value: str, /) -> Self:
            """
            Resource is the type of resource being referenced, for example "pods".
            """
            return self._set("resource", value)

        def uid(self, value: str, /) -> Self:
            """
            UID identifies exactly one incarnation of the resource.
            """
            return self._set("uid", value)

    class BuilderContext(BuilderContextBase["ResourceClaimConsumerReference.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimConsumerReference.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimConsumerReference."""
        return cls.BuilderContext()

    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")] = None
    """
    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.
    """
    name: str
    """
    Name is the name of resource being referenced.
    """
    resource: str
    """
    Resource is the type of resource being referenced, for example "pods".
    """
    uid: str
    """
    UID identifies exactly one incarnation of the resource.
    """


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

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

        def api_group(self, value: Optional[str], /) -> Self:
            """
            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.
            """
            return self._set("api_group", value)

        def kind(self, value: str, /) -> Self:
            """
            Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata, for example "ConfigMap".
            """
            return self._set("kind", value)

        def name(self, value: str, /) -> Self:
            """
            Name is the name of resource being referenced.
            """
            return self._set("name", value)

    class BuilderContext(BuilderContextBase["ResourceClaimParametersReference.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimParametersReference.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimParametersReference."""
        return cls.BuilderContext()

    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")] = None
    """
    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.
    """
    kind: str
    """
    Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata, for example "ConfigMap".
    """
    name: str
    """
    Name is the name of resource being referenced.
    """


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

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

        def name(self, value: Optional[str], /) -> Self:
            """
            Name matches the pod.spec.resourceClaims[*].Name field.
            """
            return self._set("name", value)

        def unsuitable_nodes(self, value: Optional[List[str]], /) -> Self:
            """
            UnsuitableNodes lists nodes that the ResourceClaim cannot be allocated for.

            The size of this field is limited to 128, the same as for PodSchedulingSpec.PotentialNodes. This may get increased in the future, but not reduced.
            """
            return self._set("unsuitable_nodes", value)

    class BuilderContext(BuilderContextBase["ResourceClaimSchedulingStatus.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimSchedulingStatus.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimSchedulingStatus."""
        return cls.BuilderContext()

    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: Optional[str] = None
    """
    Name matches the pod.spec.resourceClaims[*].Name field.
    """
    unsuitable_nodes: Annotated[Optional[List[str]], Field(alias="unsuitableNodes")] = None
    """
    UnsuitableNodes lists nodes that the ResourceClaim cannot be allocated for.

    The size of this field is limited to 128, the same as for PodSchedulingSpec.PotentialNodes. This may get increased in the future, but not reduced.
    """


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

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

        def allocation_mode(self, value: Optional[str], /) -> Self:
            """
            Allocation can start immediately or when a Pod wants to use the resource. "WaitForFirstConsumer" is the default.
            """
            return self._set("allocation_mode", value)

        @overload
        def parameters_ref(
            self, value_or_callback: Optional[ResourceClaimParametersReference], /
        ) -> "ResourceClaimSpec.Builder": ...

        @overload
        def parameters_ref(
            self,
            value_or_callback: Callable[
                [ResourceClaimParametersReference.Builder],
                ResourceClaimParametersReference.Builder | ResourceClaimParametersReference,
            ],
            /,
        ) -> "ResourceClaimSpec.Builder": ...

        @overload
        def parameters_ref(
            self, value_or_callback: Never = ...
        ) -> "ResourceClaimParametersReference.BuilderContext": ...

        def parameters_ref(self, value_or_callback=None, /):
            """
            ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim.

            The object must be in the same namespace as the ResourceClaim.
            """
            if self._in_context and value_or_callback is None:
                context = ResourceClaimParametersReference.BuilderContext()
                context._parent_builder = self
                context._field_name = "parameters_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimParametersReference.builder())
                if isinstance(output, ResourceClaimParametersReference.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("parameters_ref", value)

        def resource_class_name(self, value: str, /) -> Self:
            """
            ResourceClassName references the driver and additional parameters via the name of a ResourceClass that was created as part of the driver deployment.
            """
            return self._set("resource_class_name", value)

    class BuilderContext(BuilderContextBase["ResourceClaimSpec.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimSpec.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimSpec."""
        return cls.BuilderContext()

    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")] = None
    """
    Allocation can start immediately or when a Pod wants to use the resource. "WaitForFirstConsumer" is the default.
    """
    parameters_ref: Annotated[
        Optional[ResourceClaimParametersReference], Field(alias="parametersRef")
    ] = None
    """
    ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim.

    The object must be in the same namespace as the ResourceClaim.
    """
    resource_class_name: Annotated[str, Field(alias="resourceClassName")]
    """
    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(BaseModelBuilder):
        @property
        def cls(self) -> Type["ResourceClassParametersReference"]:
            return ResourceClassParametersReference

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

        def api_group(self, value: Optional[str], /) -> Self:
            """
            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.
            """
            return self._set("api_group", value)

        def kind(self, value: str, /) -> Self:
            """
            Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata.
            """
            return self._set("kind", value)

        def name(self, value: str, /) -> Self:
            """
            Name is the name of resource being referenced.
            """
            return self._set("name", value)

        def namespace(self, value: Optional[str], /) -> Self:
            """
            Namespace that contains the referenced resource. Must be empty for cluster-scoped resources and non-empty for namespaced resources.
            """
            return self._set("namespace", value)

    class BuilderContext(BuilderContextBase["ResourceClassParametersReference.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClassParametersReference.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClassParametersReference."""
        return cls.BuilderContext()

    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")] = None
    """
    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.
    """
    kind: str
    """
    Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata.
    """
    name: str
    """
    Name is the name of resource being referenced.
    """
    namespace: Optional[str] = None
    """
    Namespace that contains the referenced resource. Must be empty for cluster-scoped resources and non-empty for namespaced resources.
    """


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

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

        def data(self, value: Optional[str], /) -> Self:
            """
            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.

            The maximum size of this field is 16KiB. This may get increased in the future, but not reduced.
            """
            return self._set("data", value)

        def driver_name(self, value: Optional[str], /) -> Self:
            """
            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.
            """
            return self._set("driver_name", value)

    class BuilderContext(BuilderContextBase["ResourceHandle.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceHandle.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceHandle."""
        return cls.BuilderContext()

    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: Optional[str] = None
    """
    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.

    The maximum size of this field is 16KiB. This may get increased in the future, but not reduced.
    """
    driver_name: Annotated[Optional[str], Field(alias="driverName")] = None
    """
    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.
    """


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

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

        @overload
        def available_on_nodes(
            self, value_or_callback: Optional[v1.NodeSelector], /
        ) -> "AllocationResult.Builder": ...

        @overload
        def available_on_nodes(
            self,
            value_or_callback: Callable[
                [v1.NodeSelector.Builder], v1.NodeSelector.Builder | v1.NodeSelector
            ],
            /,
        ) -> "AllocationResult.Builder": ...

        @overload
        def available_on_nodes(
            self, value_or_callback: Never = ...
        ) -> "v1.NodeSelector.BuilderContext": ...

        def available_on_nodes(self, value_or_callback=None, /):
            """
            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.

            Setting this field is optional. If null, the resource is available everywhere.
            """
            if self._in_context and value_or_callback is None:
                context = v1.NodeSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "available_on_nodes"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(v1.NodeSelector.builder())
                if isinstance(output, v1.NodeSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("available_on_nodes", value)

        @overload
        def resource_handles(
            self, value_or_callback: List[ResourceHandle], /
        ) -> "AllocationResult.Builder": ...

        @overload
        def resource_handles(
            self,
            value_or_callback: Callable[
                [GenericListBuilder[ResourceHandle, ResourceHandle.Builder]],
                GenericListBuilder[ResourceHandle, ResourceHandle.Builder] | List[ResourceHandle],
            ],
            /,
        ) -> "AllocationResult.Builder": ...

        @overload
        def resource_handles(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[ResourceHandle.Builder]: ...

        def resource_handles(self, value_or_callback=None, /):
            """
            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.

            Setting 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.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[ResourceHandle.Builder]()
                context._parent_builder = self
                context._field_name = "resource_handles"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceHandle.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("resource_handles", value)

        def shareable(self, value: Optional[bool], /) -> Self:
            """
            Shareable determines whether the resource supports more than one consumer at a time.
            """
            return self._set("shareable", value)

    class BuilderContext(BuilderContextBase["AllocationResult.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = AllocationResult.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for AllocationResult."""
        return cls.BuilderContext()

    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")] = None
    """
    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.

    Setting this field is optional. If null, the resource is available everywhere.
    """
    resource_handles: Annotated[Optional[List[ResourceHandle]], Field(alias="resourceHandles")] = (
        None
    )
    """
    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.

    Setting 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.
    """
    shareable: Optional[bool] = None
    """
    Shareable determines whether the resource supports more than one consumer at a time.
    """


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

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

        @overload
        def resource_claims(
            self, value_or_callback: List[ResourceClaimSchedulingStatus], /
        ) -> "PodSchedulingContextStatus.Builder": ...

        @overload
        def resource_claims(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        ResourceClaimSchedulingStatus,
                        ResourceClaimSchedulingStatus.Builder,
                    ]
                ],
                GenericListBuilder[
                    ResourceClaimSchedulingStatus, ResourceClaimSchedulingStatus.Builder
                ]
                | List[ResourceClaimSchedulingStatus],
            ],
            /,
        ) -> "PodSchedulingContextStatus.Builder": ...

        @overload
        def resource_claims(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[ResourceClaimSchedulingStatus.Builder]: ...

        def resource_claims(self, value_or_callback=None, /):
            """
            ResourceClaims describes resource availability for each pod.spec.resourceClaim entry where the corresponding ResourceClaim uses "WaitForFirstConsumer" allocation mode.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[ResourceClaimSchedulingStatus.Builder]()
                context._parent_builder = self
                context._field_name = "resource_claims"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimSchedulingStatus.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("resource_claims", value)

    class BuilderContext(BuilderContextBase["PodSchedulingContextStatus.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodSchedulingContextStatus.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodSchedulingContextStatus."""
        return cls.BuilderContext()

    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")
    ] = None
    """
    ResourceClaims describes resource availability for each pod.spec.resourceClaim entry where the corresponding ResourceClaim uses "WaitForFirstConsumer" allocation mode.
    """


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

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

        @overload
        def allocation(
            self, value_or_callback: Optional[AllocationResult], /
        ) -> "ResourceClaimStatus.Builder": ...

        @overload
        def allocation(
            self,
            value_or_callback: Callable[
                [AllocationResult.Builder], AllocationResult.Builder | AllocationResult
            ],
            /,
        ) -> "ResourceClaimStatus.Builder": ...

        @overload
        def allocation(
            self, value_or_callback: Never = ...
        ) -> "AllocationResult.BuilderContext": ...

        def allocation(self, value_or_callback=None, /):
            """
            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.
            """
            if self._in_context and value_or_callback is None:
                context = AllocationResult.BuilderContext()
                context._parent_builder = self
                context._field_name = "allocation"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(AllocationResult.builder())
                if isinstance(output, AllocationResult.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("allocation", value)

        def deallocation_requested(self, value: Optional[bool], /) -> Self:
            """
            DeallocationRequested indicates that a ResourceClaim is to be deallocated.

            The driver then must deallocate this claim and reset the field together with clearing the Allocation field.

            While DeallocationRequested is set, no new consumers may be added to ReservedFor.
            """
            return self._set("deallocation_requested", value)

        def driver_name(self, value: Optional[str], /) -> Self:
            """
            DriverName is a copy of the driver name from the ResourceClass at the time when allocation started.
            """
            return self._set("driver_name", value)

        @overload
        def reserved_for(
            self, value_or_callback: List[ResourceClaimConsumerReference], /
        ) -> "ResourceClaimStatus.Builder": ...

        @overload
        def reserved_for(
            self,
            value_or_callback: Callable[
                [
                    GenericListBuilder[
                        ResourceClaimConsumerReference,
                        ResourceClaimConsumerReference.Builder,
                    ]
                ],
                GenericListBuilder[
                    ResourceClaimConsumerReference,
                    ResourceClaimConsumerReference.Builder,
                ]
                | List[ResourceClaimConsumerReference],
            ],
            /,
        ) -> "ResourceClaimStatus.Builder": ...

        @overload
        def reserved_for(
            self, value_or_callback: Never = ...
        ) -> ListBuilderContext[ResourceClaimConsumerReference.Builder]: ...

        def reserved_for(self, value_or_callback=None, /):
            """
            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.

            There can be at most 32 such reservations. This may get increased in the future, but not reduced.
            """
            if self._in_context and value_or_callback is None:
                context = ListBuilderContext[ResourceClaimConsumerReference.Builder]()
                context._parent_builder = self
                context._field_name = "reserved_for"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimConsumerReference.list_builder())
                if isinstance(output, GenericListBuilder):
                    value = output.build()
                else:
                    value = output
            return self._set("reserved_for", value)

    class BuilderContext(BuilderContextBase["ResourceClaimStatus.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimStatus.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimStatus."""
        return cls.BuilderContext()

    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: Optional[AllocationResult] = None
    """
    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.
    """
    deallocation_requested: Annotated[Optional[bool], Field(alias="deallocationRequested")] = None
    """
    DeallocationRequested indicates that a ResourceClaim is to be deallocated.

    The driver then must deallocate this claim and reset the field together with clearing the Allocation field.

    While DeallocationRequested is set, no new consumers may be added to ReservedFor.
    """
    driver_name: Annotated[Optional[str], Field(alias="driverName")] = None
    """
    DriverName is a copy of the driver name from the ResourceClass at the time when allocation started.
    """
    reserved_for: Annotated[
        Optional[List[ResourceClaimConsumerReference]], Field(alias="reservedFor")
    ] = None
    """
    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.

    There can be at most 32 such reservations. This may get increased in the future, but not reduced.
    """


class PodSchedulingContext(Resource):
    class Builder(BaseModelBuilder):
        @property
        def cls(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:
            """
            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
            """
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["PodSchedulingContext"]], /) -> Self:
            """
            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
            """
            return self._set("kind", value)

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "PodSchedulingContext.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "PodSchedulingContext.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            Standard object metadata
            """
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(
            self, value_or_callback: PodSchedulingContextSpec, /
        ) -> "PodSchedulingContext.Builder": ...

        @overload
        def spec(
            self,
            value_or_callback: Callable[
                [PodSchedulingContextSpec.Builder],
                PodSchedulingContextSpec.Builder | PodSchedulingContextSpec,
            ],
            /,
        ) -> "PodSchedulingContext.Builder": ...

        @overload
        def spec(
            self, value_or_callback: Never = ...
        ) -> "PodSchedulingContextSpec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            """
            Spec describes where resources for the Pod are needed.
            """
            if self._in_context and value_or_callback is None:
                context = PodSchedulingContextSpec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodSchedulingContextSpec.builder())
                if isinstance(output, PodSchedulingContextSpec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

        @overload
        def status(
            self, value_or_callback: Optional[PodSchedulingContextStatus], /
        ) -> "PodSchedulingContext.Builder": ...

        @overload
        def status(
            self,
            value_or_callback: Callable[
                [PodSchedulingContextStatus.Builder],
                PodSchedulingContextStatus.Builder | PodSchedulingContextStatus,
            ],
            /,
        ) -> "PodSchedulingContext.Builder": ...

        @overload
        def status(
            self, value_or_callback: Never = ...
        ) -> "PodSchedulingContextStatus.BuilderContext": ...

        def status(self, value_or_callback=None, /):
            """
            Status describes where resources for the Pod can be allocated.
            """
            if self._in_context and value_or_callback is None:
                context = PodSchedulingContextStatus.BuilderContext()
                context._parent_builder = self
                context._field_name = "status"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(PodSchedulingContextStatus.builder())
                if isinstance(output, PodSchedulingContextStatus.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("status", value)

    class BuilderContext(BuilderContextBase["PodSchedulingContext.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = PodSchedulingContext.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for PodSchedulingContext."""
        return cls.BuilderContext()

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


PodSchedulingContextList = ResourceList["PodSchedulingContext"]


class ResourceClaim(Resource):
    class Builder(BaseModelBuilder):
        @property
        def cls(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:
            """
            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
            """
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["ResourceClaim"]], /) -> Self:
            """
            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
            """
            return self._set("kind", value)

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "ResourceClaim.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "ResourceClaim.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            Standard object metadata
            """
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(self, value_or_callback: ResourceClaimSpec, /) -> "ResourceClaim.Builder": ...

        @overload
        def spec(
            self,
            value_or_callback: Callable[
                [ResourceClaimSpec.Builder],
                ResourceClaimSpec.Builder | ResourceClaimSpec,
            ],
            /,
        ) -> "ResourceClaim.Builder": ...

        @overload
        def spec(self, value_or_callback: Never = ...) -> "ResourceClaimSpec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            """
            Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim.
            """
            if self._in_context and value_or_callback is None:
                context = ResourceClaimSpec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimSpec.builder())
                if isinstance(output, ResourceClaimSpec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

        @overload
        def status(
            self, value_or_callback: Optional[ResourceClaimStatus], /
        ) -> "ResourceClaim.Builder": ...

        @overload
        def status(
            self,
            value_or_callback: Callable[
                [ResourceClaimStatus.Builder],
                ResourceClaimStatus.Builder | ResourceClaimStatus,
            ],
            /,
        ) -> "ResourceClaim.Builder": ...

        @overload
        def status(
            self, value_or_callback: Never = ...
        ) -> "ResourceClaimStatus.BuilderContext": ...

        def status(self, value_or_callback=None, /):
            """
            Status describes whether the resource is available and with which attributes.
            """
            if self._in_context and value_or_callback is None:
                context = ResourceClaimStatus.BuilderContext()
                context._parent_builder = self
                context._field_name = "status"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimStatus.builder())
                if isinstance(output, ResourceClaimStatus.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("status", value)

    class BuilderContext(BuilderContextBase["ResourceClaim.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaim.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaim."""
        return cls.BuilderContext()

    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")
    ] = "resource.k8s.io/v1alpha2"
    """
    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
    """
    kind: Optional[Literal["ResourceClaim"]] = "ResourceClaim"
    """
    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
    """
    metadata: Optional[apimachinery.ObjectMeta] = None
    """
    Standard object metadata
    """
    spec: ResourceClaimSpec
    """
    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: Optional[ResourceClaimStatus] = None
    """
    Status describes whether the resource is available and with which attributes.
    """


ResourceClaimList = ResourceList["ResourceClaim"]


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

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

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "ResourceClaimTemplateSpec.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "ResourceClaimTemplateSpec.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            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.
            """
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(
            self, value_or_callback: ResourceClaimSpec, /
        ) -> "ResourceClaimTemplateSpec.Builder": ...

        @overload
        def spec(
            self,
            value_or_callback: Callable[
                [ResourceClaimSpec.Builder],
                ResourceClaimSpec.Builder | ResourceClaimSpec,
            ],
            /,
        ) -> "ResourceClaimTemplateSpec.Builder": ...

        @overload
        def spec(self, value_or_callback: Never = ...) -> "ResourceClaimSpec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            """
            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.
            """
            if self._in_context and value_or_callback is None:
                context = ResourceClaimSpec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimSpec.builder())
                if isinstance(output, ResourceClaimSpec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

    class BuilderContext(BuilderContextBase["ResourceClaimTemplateSpec.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimTemplateSpec.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimTemplateSpec."""
        return cls.BuilderContext()

    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: Optional[apimachinery.ObjectMeta] = None
    """
    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.
    """
    spec: ResourceClaimSpec
    """
    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(BaseModelBuilder):
        @property
        def cls(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:
            """
            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
            """
            return self._set("api_version", value)

        def driver_name(self, value: str, /) -> Self:
            """
            DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.

            Resource drivers have a unique name in forward domain order (acme.example.com).
            """
            return self._set("driver_name", value)

        def kind(self, value: Optional[Literal["ResourceClass"]], /) -> Self:
            """
            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
            """
            return self._set("kind", value)

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "ResourceClass.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "ResourceClass.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            Standard object metadata
            """
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def parameters_ref(
            self, value_or_callback: Optional[ResourceClassParametersReference], /
        ) -> "ResourceClass.Builder": ...

        @overload
        def parameters_ref(
            self,
            value_or_callback: Callable[
                [ResourceClassParametersReference.Builder],
                ResourceClassParametersReference.Builder | ResourceClassParametersReference,
            ],
            /,
        ) -> "ResourceClass.Builder": ...

        @overload
        def parameters_ref(
            self, value_or_callback: Never = ...
        ) -> "ResourceClassParametersReference.BuilderContext": ...

        def parameters_ref(self, value_or_callback=None, /):
            """
            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.
            """
            if self._in_context and value_or_callback is None:
                context = ResourceClassParametersReference.BuilderContext()
                context._parent_builder = self
                context._field_name = "parameters_ref"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClassParametersReference.builder())
                if isinstance(output, ResourceClassParametersReference.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("parameters_ref", value)

        @overload
        def suitable_nodes(
            self, value_or_callback: Optional[v1.NodeSelector], /
        ) -> "ResourceClass.Builder": ...

        @overload
        def suitable_nodes(
            self,
            value_or_callback: Callable[
                [v1.NodeSelector.Builder], v1.NodeSelector.Builder | v1.NodeSelector
            ],
            /,
        ) -> "ResourceClass.Builder": ...

        @overload
        def suitable_nodes(
            self, value_or_callback: Never = ...
        ) -> "v1.NodeSelector.BuilderContext": ...

        def suitable_nodes(self, value_or_callback=None, /):
            """
            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.

            Setting this field is optional. If null, all nodes are candidates.
            """
            if self._in_context and value_or_callback is None:
                context = v1.NodeSelector.BuilderContext()
                context._parent_builder = self
                context._field_name = "suitable_nodes"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(v1.NodeSelector.builder())
                if isinstance(output, v1.NodeSelector.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("suitable_nodes", value)

    class BuilderContext(BuilderContextBase["ResourceClass.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClass.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClass."""
        return cls.BuilderContext()

    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")
    ] = "resource.k8s.io/v1alpha2"
    """
    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
    """
    driver_name: Annotated[str, Field(alias="driverName")]
    """
    DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.

    Resource drivers have a unique name in forward domain order (acme.example.com).
    """
    kind: Optional[Literal["ResourceClass"]] = "ResourceClass"
    """
    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
    """
    metadata: Optional[apimachinery.ObjectMeta] = None
    """
    Standard object metadata
    """
    parameters_ref: Annotated[
        Optional[ResourceClassParametersReference], Field(alias="parametersRef")
    ] = None
    """
    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.
    """
    suitable_nodes: Annotated[Optional[v1.NodeSelector], Field(alias="suitableNodes")] = None
    """
    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.

    Setting this field is optional. If null, all nodes are candidates.
    """


ResourceClassList = ResourceList["ResourceClass"]


class ResourceClaimTemplate(Resource):
    class Builder(BaseModelBuilder):
        @property
        def cls(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:
            """
            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
            """
            return self._set("api_version", value)

        def kind(self, value: Optional[Literal["ResourceClaimTemplate"]], /) -> Self:
            """
            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
            """
            return self._set("kind", value)

        @overload
        def metadata(
            self, value_or_callback: Optional[apimachinery.ObjectMeta], /
        ) -> "ResourceClaimTemplate.Builder": ...

        @overload
        def metadata(
            self,
            value_or_callback: Callable[
                [apimachinery.ObjectMeta.Builder],
                apimachinery.ObjectMeta.Builder | apimachinery.ObjectMeta,
            ],
            /,
        ) -> "ResourceClaimTemplate.Builder": ...

        @overload
        def metadata(
            self, value_or_callback: Never = ...
        ) -> "apimachinery.ObjectMeta.BuilderContext": ...

        def metadata(self, value_or_callback=None, /):
            """
            Standard object metadata
            """
            if self._in_context and value_or_callback is None:
                context = apimachinery.ObjectMeta.BuilderContext()
                context._parent_builder = self
                context._field_name = "metadata"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(apimachinery.ObjectMeta.builder())
                if isinstance(output, apimachinery.ObjectMeta.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("metadata", value)

        @overload
        def spec(
            self, value_or_callback: ResourceClaimTemplateSpec, /
        ) -> "ResourceClaimTemplate.Builder": ...

        @overload
        def spec(
            self,
            value_or_callback: Callable[
                [ResourceClaimTemplateSpec.Builder],
                ResourceClaimTemplateSpec.Builder | ResourceClaimTemplateSpec,
            ],
            /,
        ) -> "ResourceClaimTemplate.Builder": ...

        @overload
        def spec(
            self, value_or_callback: Never = ...
        ) -> "ResourceClaimTemplateSpec.BuilderContext": ...

        def spec(self, value_or_callback=None, /):
            """
            Describes the ResourceClaim that is to be generated.

            This field is immutable. A ResourceClaim will get created by the control plane for a Pod when needed and then not get updated anymore.
            """
            if self._in_context and value_or_callback is None:
                context = ResourceClaimTemplateSpec.BuilderContext()
                context._parent_builder = self
                context._field_name = "spec"
                return context

            value = value_or_callback
            if callable(value_or_callback):
                output = value_or_callback(ResourceClaimTemplateSpec.builder())
                if isinstance(output, ResourceClaimTemplateSpec.Builder):
                    value = output.build()
                else:
                    value = output
            return self._set("spec", value)

    class BuilderContext(BuilderContextBase["ResourceClaimTemplate.Builder"]):
        def model_post_init(self, __context) -> None:
            self._builder = ResourceClaimTemplate.Builder()
            self._builder._in_context = True
            self._parent_builder = None
            self._field_name = None

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

    @classmethod
    def new(cls) -> BuilderContext:
        """Creates a new context manager builder for ResourceClaimTemplate."""
        return cls.BuilderContext()

    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")
    ] = "resource.k8s.io/v1alpha2"
    """
    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
    """
    kind: Optional[Literal["ResourceClaimTemplate"]] = "ResourceClaimTemplate"
    """
    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
    """
    metadata: Optional[apimachinery.ObjectMeta] = None
    """
    Standard object metadata
    """
    spec: ResourceClaimTemplateSpec
    """
    Describes the ResourceClaim that is to be generated.

    This 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"]
