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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .feature_flag import FeatureFlag
from .organization_billing import OrganizationBilling


class OrganizationWithRole(UniversalBaseModel):
    """
    Organization schema with user's role information.
    """

    id: str
    name: str
    description: typing.Optional[str] = None
    created_at: dt.datetime
    modified_at: dt.datetime
    role: str
    is_primary: bool
    auth_0_org_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="auth0_org_id")] = None
    org_type: typing.Optional[str] = None
    org_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    enabled_features: typing.Optional[typing.List[FeatureFlag]] = pydantic.Field(default=None)
    """
    List of enabled feature flags for this organization
    """

    billing: typing.Optional[OrganizationBilling] = pydantic.Field(default=None)
    """
    Complete billing information including current period
    """

    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
