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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import datetime as dt
import typing
from .session_mode_dto import SessionModeDto
from .consumption_offsets import ConsumptionOffsets
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Session(UniversalBaseModel):
    """
    A session represents an ongoing conversation between an agent and a customer.
    """

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

    agent_id: str = pydantic.Field()
    """
    Unique identifier for the agent associated with the session.
    """

    customer_id: str = pydantic.Field()
    """
    ID of the customer associated with this session.
    """

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

    title: typing.Optional[str] = pydantic.Field(default=None)
    """
    Descriptive title for the session
    """

    mode: SessionModeDto = pydantic.Field()
    """
    The mode of the session, either 'auto' or 'manual'. In manual mode, events added to a session will not be responded to automatically by the agent.
    """

    consumption_offsets: ConsumptionOffsets
    metadata: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field()
    """
    Metadata for the session
    """

    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
