# 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 .auto_sync_info import AutoSyncInfo
from .document_usage_mode_enum import DocumentUsageModeEnum
from .external_folder_sync_info import ExternalFolderSyncInfo
from .kb_external_sync_job import KbExternalSyncJob
from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel
from .knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel
from .resource_access_info import ResourceAccessInfo


class GetKnowledgeBaseFolderResponseModel(UncheckedBaseModel):
    id: str
    name: str
    metadata: KnowledgeBaseDocumentMetadataResponseModel
    supported_usages: typing.List[DocumentUsageModeEnum]
    access_info: ResourceAccessInfo
    folder_parent_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the parent folder, or null if the document is at the root level.
    """

    folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = pydantic.Field(
        default=None
    )
    """
    The folder path segments leading to this entity, from root to parent folder.
    """

    children_count: int
    document_count: int = pydantic.Field()
    """
    Number of non-folder documents anywhere in this folder's subtree (recursive). Counting stops past 1000;
    """

    auto_sync_info: typing.Optional[AutoSyncInfo] = None
    external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None
    is_frozen: typing.Optional[bool] = None
    active_sync_job: typing.Optional[KbExternalSyncJob] = pydantic.Field(default=None)
    """
    Most recent (in-flight or terminal) external sync job for this folder, if any. Used by clients to render sync progress.
    """

    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
