# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .namespace_status import NamespaceStatus


class Namespace(UniversalBaseModel):
    """
    Response model for namespace.
    """

    artifact_registry: typing.Optional[str] = pydantic.Field(default=None)
    """
    Artifact Registry repository name.
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the namespace was created.
    """

    created_by: str = pydantic.Field()
    """
    member_id of the creator.
    """

    error: typing.Optional[str] = pydantic.Field(default=None)
    """
    Error message if provisioning failed.
    """

    error_step: typing.Optional[str] = pydantic.Field(default=None)
    """
    Which provisioning step failed (e.g., 'create_gcs_bucket').
    """

    gcp_sa_email: typing.Optional[str] = pydantic.Field(default=None)
    """
    GCP service account email.
    """

    gcs_bucket: typing.Optional[str] = pydantic.Field(default=None)
    """
    GCS bucket name.
    """

    id: str = pydantic.Field()
    """
    The unique identifier of the namespace.
    """

    k8s_namespace: typing.Optional[str] = pydantic.Field(default=None)
    """
    K8s namespace name.
    """

    name: str = pydantic.Field()
    """
    Human-readable name for the namespace.
    """

    owner_org_id: str = pydantic.Field()
    """
    WorkOS organization ID that owns this namespace.
    """

    registry_sa_email: typing.Optional[str] = pydantic.Field(default=None)
    """
    Registry service account email for token generation.
    """

    slug: str = pydantic.Field()
    """
    URL-friendly unique identifier.
    """

    status: typing.Optional[NamespaceStatus] = pydantic.Field(default=None)
    """
    Namespace status: pending, ready, or failed.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
