# 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
from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
from .whats_app_template_document_param_details import WhatsAppTemplateDocumentParamDetails
from .whats_app_template_image_param_details import WhatsAppTemplateImageParamDetails
from .whats_app_template_location_param_details import WhatsAppTemplateLocationParamDetails


class WhatsAppTemplateHeaderComponentParamsParametersItem_Document(UncheckedBaseModel):
    type: typing.Literal["document"] = "document"
    document: WhatsAppTemplateDocumentParamDetails

    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 WhatsAppTemplateHeaderComponentParamsParametersItem_Image(UncheckedBaseModel):
    type: typing.Literal["image"] = "image"
    image: WhatsAppTemplateImageParamDetails

    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 WhatsAppTemplateHeaderComponentParamsParametersItem_Location(UncheckedBaseModel):
    type: typing.Literal["location"] = "location"
    location: WhatsAppTemplateLocationParamDetails

    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 WhatsAppTemplateHeaderComponentParamsParametersItem_Text(UncheckedBaseModel):
    type: typing.Literal["text"] = "text"
    parameter_name: typing.Optional[str] = None
    text: 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


WhatsAppTemplateHeaderComponentParamsParametersItem = typing_extensions.Annotated[
    typing.Union[
        WhatsAppTemplateHeaderComponentParamsParametersItem_Document,
        WhatsAppTemplateHeaderComponentParamsParametersItem_Image,
        WhatsAppTemplateHeaderComponentParamsParametersItem_Location,
        WhatsAppTemplateHeaderComponentParamsParametersItem_Text,
    ],
    UnionMetadata(discriminant="type"),
]
