# 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, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .dataformat import Dataformat


class Source_Live(UniversalBaseModel):
    source_type: typing_extensions.Annotated[typing.Literal["live"], FieldMetadata(alias="sourceType")] = "live"
    url: str
    params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    data_format: typing_extensions.Annotated[typing.Optional[Dataformat], FieldMetadata(alias="dataFormat")] = None
    aliases: typing.Optional[typing.Dict[str, str]] = None
    headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
    datetime_format: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="datetimeFormat")] = 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


class Source_Static(UniversalBaseModel):
    source_type: typing_extensions.Annotated[typing.Literal["static"], FieldMetadata(alias="sourceType")] = "static"
    data: typing.Optional[typing.Any] = 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


Source = typing.Union[Source_Live, Source_Static]
