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

from __future__ import annotations

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

from pydantic import Field

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

from . import v1


class SelfSubjectReviewStatus(BaseModel):
    class Builder(BaseBuilder):
        def build(self) -> "SelfSubjectReviewStatus":
            return SelfSubjectReviewStatus(**self._attrs)

        def user_info(
            self,
            value_or_callback: Union[
                Optional[v1.UserInfo], Callable[[Type[v1.UserInfo]], v1.UserInfo]
            ],
        ) -> Self:
            value = value_or_callback
            if callable(value_or_callback):
                value = value_or_callback(v1.UserInfo)
            return self._set("user_info", value)

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

    @classmethod
    def list_builder(cls) -> ListBuilder[Self]:
        return ListBuilder[cls]()  # type: ignore[valid-type]

    user_info: Annotated[
        Optional[v1.UserInfo],
        Field(
            alias="userInfo",
            description="User attributes of the user making this request.",
        ),
    ] = None


class SelfSubjectReview(Resource):
    class Builder(BaseBuilder):
        def build(self) -> "SelfSubjectReview":
            return SelfSubjectReview(**self._attrs)

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

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

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

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

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

    @classmethod
    def list_builder(cls) -> ListBuilder[Self]:
        return ListBuilder[cls]()  # type: ignore[valid-type]

    api_version: Annotated[
        Optional[Literal["authentication.k8s.io/v1alpha1"]],
        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",
        ),
    ] = "authentication.k8s.io/v1alpha1"
    kind: Annotated[
        Optional[Literal["SelfSubjectReview"]],
        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"
        ),
    ] = "SelfSubjectReview"
    metadata: Annotated[
        Optional[apimachinery.ObjectMeta],
        Field(
            description="Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
        ),
    ] = None
    status: Annotated[
        Optional[SelfSubjectReviewStatus],
        Field(description="Status is filled in by the server with the user attributes."),
    ] = None
