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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ......core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class UserMetadata_MachineUserMetadata(UniversalBaseModel):
    """
    Examples
    --------
    from candid.resources.users.resources.v_2 import UserMetadata_HumanUserMetadata

    UserMetadata_HumanUserMetadata(
        first_name="John",
        last_name="Doe",
        email="john.doe@example.com",
    )
    """

    type: typing.Literal["machine_user_metadata"] = "machine_user_metadata"
    name: str

    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


class UserMetadata_HumanUserMetadata(UniversalBaseModel):
    """
    Examples
    --------
    from candid.resources.users.resources.v_2 import UserMetadata_HumanUserMetadata

    UserMetadata_HumanUserMetadata(
        first_name="John",
        last_name="Doe",
        email="john.doe@example.com",
    )
    """

    type: typing.Literal["human_user_metadata"] = "human_user_metadata"
    first_name: str
    last_name: str
    email: str

    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


"""
from candid.resources.users.resources.v_2 import UserMetadata_HumanUserMetadata

UserMetadata_HumanUserMetadata(
    first_name="John",
    last_name="Doe",
    email="john.doe@example.com",
)
"""
UserMetadata = typing_extensions.Annotated[
    typing.Union[UserMetadata_MachineUserMetadata, UserMetadata_HumanUserMetadata], pydantic.Field(discriminator="type")
]
