# 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 .file_resource_info_value import FileResourceInfoValue
from .file_permission_info_value import FilePermissionInfoValue
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class File(UniversalBaseModel):
    """
    Schema for a file.
    """

    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
    external_file_id: str = pydantic.Field()
    """
    The ID of the file in the external system
    """

    file_size: typing.Optional[int] = pydantic.Field(default=None)
    """
    Size of the file in bytes
    """

    file_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    File type (e.g. pdf, docx, etc.)
    """

    project_id: str = pydantic.Field()
    """
    The ID of the project that the file belongs to
    """

    last_modified_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    The last modified time of the file
    """

    resource_info: typing.Optional[typing.Dict[str, typing.Optional[FileResourceInfoValue]]] = pydantic.Field(
        default=None
    )
    """
    Resource information for the file
    """

    permission_info: typing.Optional[typing.Dict[str, typing.Optional[FilePermissionInfoValue]]] = pydantic.Field(
        default=None
    )
    """
    Permission information for the file
    """

    data_source_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the data source that the file belongs to
    """

    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
