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

import typing

import pydantic
from ......core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .....commons.types.organization_id import OrganizationId
from .....commons.types.user_id import UserId
from .idp_user_metadata import IdpUserMetadata
from .user_metadata import UserMetadata


class UserV2(UniversalBaseModel):
    """
    Examples
    --------
    import uuid

    from candid.resources.users.resources.v_2 import (
        IdpUserMetadata_AuthZeroMetadata,
        UserMetadata_HumanUserMetadata,
        UserV2,
    )

    UserV2(
        user_id=uuid.UUID(
            "1503a782-35f6-45a7-b5c3-53ca2ebe8887",
        ),
        idp_metadata=[
            IdpUserMetadata_AuthZeroMetadata(
                auth_0_id="auth0|5f9b3b5a7b0b0d006a2b0b0b",
            )
        ],
        primary_organization_id=uuid.UUID(
            "83a2a782-35f6-45a7-b5c3-53ca2ebe8887",
        ),
        user_metadata=UserMetadata_HumanUserMetadata(
            first_name="John",
            last_name="Doe",
            email="john.doe@example.com",
        ),
    )
    """

    user_id: UserId
    idp_metadata: typing.List[IdpUserMetadata]
    primary_organization_id: typing.Optional[OrganizationId] = None
    user_metadata: UserMetadata

    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
