# 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 .pipeline_file_resource_info_value import PipelineFileResourceInfoValue
from .pipeline_file_permission_info_value import PipelineFilePermissionInfoValue
from .pipeline_file_custom_metadata_value import PipelineFileCustomMetadataValue
from .pipeline_file_config_hash_value import PipelineFileConfigHashValue
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class PipelineFile(UniversalBaseModel):
    """
    Schema for a file that is associated with a pipeline.
    """

    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: typing.Optional[str] = None
    external_file_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    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[PipelineFileResourceInfoValue]]] = pydantic.Field(
        default=None
    )
    """
    Resource information for the file
    """

    permission_info: typing.Optional[typing.Dict[str, typing.Optional[PipelineFilePermissionInfoValue]]] = (
        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
    """

    file_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the file
    """

    pipeline_id: str = pydantic.Field()
    """
    The ID of the pipeline that the file is associated with
    """

    custom_metadata: typing.Optional[typing.Dict[str, typing.Optional[PipelineFileCustomMetadataValue]]] = (
        pydantic.Field(default=None)
    )
    """
    Custom metadata for the file
    """

    config_hash: typing.Optional[typing.Dict[str, typing.Optional[PipelineFileConfigHashValue]]] = pydantic.Field(
        default=None
    )
    """
    Hashes for the configuration of the pipeline.
    """

    indexed_page_count: typing.Optional[int] = pydantic.Field(default=None)
    """
    The number of pages that have been indexed for this file
    """

    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
