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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
import datetime as dt
from .configurable_data_source_names import ConfigurableDataSourceNames
from .data_source_custom_metadata_value import DataSourceCustomMetadataValue
from .data_source_create_component import DataSourceCreateComponent
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class DataSource(UniversalBaseModel):
    """
    Schema for a data source.
    """

    id: str = pydantic.Field()
    """
    Unique identifier
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Creation datetime
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Update datetime
    """

    name: str = pydantic.Field()
    """
    The name of the data source.
    """

    source_type: ConfigurableDataSourceNames
    custom_metadata: typing.Optional[typing.Dict[str, typing.Optional[DataSourceCustomMetadataValue]]] = pydantic.Field(
        default=None
    )
    """
    Custom metadata that will be present on all data loaded from the data source
    """

    component: DataSourceCreateComponent = pydantic.Field()
    """
    Component that implements the data source
    """

    project_id: 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
