# 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 ...types.map_config import MapConfig
from ...types.time_series_config import TimeSeriesConfig


class ListComponentsApiV1DashboardComponentsGetResponseItem_Map(UniversalBaseModel):
    type: typing.Literal["map"] = "map"
    id: typing.Optional[str] = None
    user_id: typing_extensions.Annotated[str, FieldMetadata(alias="userId")]
    name: str
    config: MapConfig
    layer_ids: typing_extensions.Annotated[typing.Optional[typing.List[str]], FieldMetadata(alias="layerIds")] = 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 ListComponentsApiV1DashboardComponentsGetResponseItem_Timeseries(UniversalBaseModel):
    type: typing.Literal["timeseries"] = "timeseries"
    id: typing.Optional[str] = None
    user_id: typing_extensions.Annotated[str, FieldMetadata(alias="userId")]
    name: str
    config: TimeSeriesConfig

    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


ListComponentsApiV1DashboardComponentsGetResponseItem = typing.Union[
    ListComponentsApiV1DashboardComponentsGetResponseItem_Map,
    ListComponentsApiV1DashboardComponentsGetResponseItem_Timeseries,
]
