# 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 .event_stream_cloud_event_a_0_purpose_enum import EventStreamCloudEventA0PurposeEnum
from .event_stream_cloud_event_spec_version_enum import EventStreamCloudEventSpecVersionEnum
from .event_stream_cloud_event_user_created_cloud_event_type_enum import (
    EventStreamCloudEventUserCreatedCloudEventTypeEnum,
)
from .event_stream_cloud_event_user_created_data import EventStreamCloudEventUserCreatedData


class EventStreamCloudEventUserCreatedCloudEvent(UniversalBaseModel):
    """
    Represents an event that occurs when a user is created.
    """

    specversion: EventStreamCloudEventSpecVersionEnum
    type: EventStreamCloudEventUserCreatedCloudEventTypeEnum
    source: str = pydantic.Field()
    """
    The source of the event. This will take the form 'urn:auth0:<tenant>.<domain>'.
    """

    id: str = pydantic.Field()
    """
    A unique identifier for the event.
    """

    time: dt.datetime = pydantic.Field()
    """
    An ISO-8601 timestamp indicating when the event physically occurred.
    """

    data: EventStreamCloudEventUserCreatedData
    a_0_tenant: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="a0tenant"),
        pydantic.Field(alias="a0tenant", description="The auth0 tenant ID to which the event is associated."),
    ]
    """
    The auth0 tenant ID to which the event is associated.
    """

    a_0_stream: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="a0stream"),
        pydantic.Field(
            alias="a0stream", description="The auth0 event stream ID of the stream the event was delivered on."
        ),
    ]
    """
    The auth0 event stream ID of the stream the event was delivered on.
    """

    a_0_purpose: typing_extensions.Annotated[
        typing.Optional[EventStreamCloudEventA0PurposeEnum],
        FieldMetadata(alias="a0purpose"),
        pydantic.Field(alias="a0purpose"),
    ] = None

    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
