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

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 ExternalFolderSyncInfo(UncheckedBaseModel):
    """
    Metadata for a KB folder that mirrors an external source folder.
    """

    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
    """

    root_folder_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    KB folder ID of the sync root. None means this folder is the root.
    """

    sync_cursor: typing.Optional[str] = pydantic.Field(default=None)
    """
    Opaque cursor for incremental sync, interpreted by the provider
    """

    last_sync_at: typing.Optional[int] = pydantic.Field(default=None)
    """
    Unix timestamp of last completed sync
    """

    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
