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

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from .browser_info import BrowserInfo
from .device_info import DeviceInfo
from .geo_info import GeoInfo
from .ip_info import IpInfo
from .language_info import LanguageInfo
from .source_type import SourceType


class SourceInfo(UniversalBaseModel):
    type: SourceType
    device_info: typing_extensions.Annotated[typing.Optional[DeviceInfo], FieldMetadata(alias="deviceInfo")] = None
    browser_info: typing_extensions.Annotated[typing.Optional[BrowserInfo], FieldMetadata(alias="browserInfo")] = None
    geo_info: typing_extensions.Annotated[typing.Optional[GeoInfo], FieldMetadata(alias="geoInfo")] = None
    ip_info: typing_extensions.Annotated[typing.Optional[IpInfo], FieldMetadata(alias="ipInfo")] = None
    language_info: typing_extensions.Annotated[typing.Optional[LanguageInfo], FieldMetadata(alias="languageInfo")] = (
        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
