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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
from .event_source_dto import EventSourceDto
from .event_kind_dto import EventKindDto
import datetime as dt
import typing
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Event(UniversalBaseModel):
    """
    Represents a single event within a session.
    """

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

    source: EventSourceDto
    kind: EventKindDto
    offset: int = pydantic.Field()
    """
    Sequential position of the event in the session
    """

    creation_utc: dt.datetime = pydantic.Field()
    """
    UTC timestamp of when the event was created
    """

    trace_id: str = pydantic.Field()
    """
    ID linking related events together
    """

    correlation_id: str = pydantic.Field()
    """
    ID linking related events together
    """

    data: typing.Optional[typing.Any] = None
    metadata: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field()
    """
    Metadata associated with the event
    """

    deleted: bool

    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
