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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .external_sync_provider import ExternalSyncProvider


class ExternalFileSyncInfo(UncheckedBaseModel):
    """
    Tracks the link back to the original file in an external source.
    """

    type: ExternalSyncProvider = pydantic.Field(default="google_drive")
    """
    Provider identifier
    """

    source_entity_id: str = pydantic.Field()
    """
    Entity ID in the external system
    """

    integration_connection_id: str = pydantic.Field()
    """
    Integration connection instance ID
    """

    source_parent_entity_id: str = pydantic.Field()
    """
    Folder ID in the external system this file was synced from
    """

    source_mime_type: str = pydantic.Field()
    """
    Original MIME type in the external system
    """

    source_modified_time: dt.datetime = pydantic.Field()
    """
    Last modified time from the external system
    """

    root_folder_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    KB folder ID of the sync root, used to query all entities under a sync tree
    """

    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
