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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .account import Account
from .subject_type import SubjectType
from .user_metadata import UserMetadata


class Session(UniversalBaseModel):
    id: str
    user_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="userName")] = None
    subject_slug: typing_extensions.Annotated[str, FieldMetadata(alias="subjectSlug")]
    subject_controller_name: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="subjectControllerName")
    ] = None
    subject_pat_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="subjectPatName")] = None
    email: typing.Optional[str] = None
    subject_type: typing_extensions.Annotated[SubjectType, FieldMetadata(alias="subjectType")]
    tenant_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="tenantName")] = None
    roles: typing.List[str]
    teams: typing.List[str]
    accounts: typing.List[str]
    metadata: typing.Optional[UserMetadata] = None
    service_account_metadata: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Any]], FieldMetadata(alias="serviceAccountMetadata")
    ] = None
    account: typing.Optional[Account] = None

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

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