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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .uui_transfer_config_protocol_discriminator_mode import UuiTransferConfigProtocolDiscriminatorMode


class UuiTransferConfig(UncheckedBaseModel):
    """
    User-to-User Information envelope for SIP REFER transfers (RFC 7433).

    Outbound payloads are hex-encoded (the only encoding RFC 7433 defines). The
    protocol discriminator axis lets per-platform formats (Talkdesk, Genesys, ...)
    be expressed by configuration rather than scattered transfer flags. Further
    axes (ASCII encoding, header name, purpose/content parameters) can be added
    here without touching the transfer model.
    """

    data: str = pydantic.Field()
    """
    UUI payload to send on SIP REFER transfers. Supports inline dynamic variables and is hex-encoded at transfer time.
    """

    protocol_discriminator: typing.Optional[str] = pydantic.Field(default=None)
    """
    Optional one-octet protocol discriminator (two hex digits, e.g. '00'). Required by platforms such as Genesys Cloud, which otherwise strip the first octet of the payload. Leave unset for platforms like Talkdesk that expect a bare hex payload.
    """

    protocol_discriminator_mode: typing.Optional[UuiTransferConfigProtocolDiscriminatorMode] = pydantic.Field(
        default=None
    )
    """
    How to attach protocol_discriminator. 'prefix' prepends the octet to the hex payload (User-to-User=XX<hex>;encoding=hex). 'pd_parameter' sends it as a separate parameter (User-to-User=<hex>;pd=XX;encoding=hex). Ignored when protocol_discriminator is unset.
    """

    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
