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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ...commons.types.entity_id import EntityId
from ...commons.types.llm_inclusion_status import LlmInclusionStatus
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.serialization import FieldMetadata
from .base_knowledge_document import BaseKnowledgeDocument


class KnowledgeDocumentSearchResponse(BaseKnowledgeDocument):
    """
    Examples
    --------
    import datetime

    from mavenagi.commons import EntityId
    from mavenagi.knowledge import KnowledgeDocumentSearchResponse

    KnowledgeDocumentSearchResponse(
        knowledge_document_id=EntityId(
            reference_id="how-it-works",
            app_id="help-center",
            organization_id="acme",
            agent_id="support",
            type="KNOWLEDGE_DOCUMENT",
        ),
        knowledge_base_version_id=EntityId(
            reference_id="version-1",
            app_id="help-center",
            organization_id="acme",
            agent_id="support",
            type="KNOWLEDGE_BASE_VERSION",
        ),
        title="How it works",
        llm_inclusion_status="WHEN_RELEVANT",
        url="https://help-center.acme.com/how-it-works",
        created_at=datetime.datetime.fromisoformat(
            "2024-01-01 00:00:00+00:00",
        ),
        updated_at=datetime.datetime.fromisoformat(
            "2024-02-02 00:00:00+00:00",
        ),
    )
    """

    knowledge_document_id: typing_extensions.Annotated[EntityId, FieldMetadata(alias="knowledgeDocumentId")] = (
        pydantic.Field()
    )
    """
    ID that uniquely identifies this knowledge document within its knowledge base
    """

    knowledge_base_version_id: typing_extensions.Annotated[
        typing.Optional[EntityId], FieldMetadata(alias="knowledgeBaseVersionId")
    ] = pydantic.Field(default=None)
    """
    ID that uniquely identifies the knowledge base version that contains this document.
    This may be missing on legacy documents.
    """

    title: typing.Optional[str] = pydantic.Field(default=None)
    """
    The title of the document. Will be shown as part of answers. May be missing on legacy documents.
    """

    llm_inclusion_status: typing_extensions.Annotated[LlmInclusionStatus, FieldMetadata(alias="llmInclusionStatus")] = (
        pydantic.Field()
    )
    """
    Whether the document is included in the agent's knowledge.
    """

    created_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="createdAt")] = pydantic.Field()
    """
    The time at which this document was created.
    """

    updated_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="updatedAt")] = pydantic.Field()
    """
    The time at which this document was last modified.
    """

    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
