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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .corpus_key import CorpusKey
from .filter_attribute import FilterAttribute
from .corpus_custom_dimension import CorpusCustomDimension
from .corpus_limits import CorpusLimits
import datetime as dt
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Corpus(UniversalBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Vectara ID of the corpus.
    """

    key: typing.Optional[CorpusKey] = None
    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Name for the corpus. This value defaults to the key.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Corpus description.
    """

    enabled: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Specifies whether the corpus is enabled or not.
    """

    chat_history_corpus: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Indicates that this corpus does not store documents and stores chats instead.
    """

    queries_are_answers: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Queries made to this corpus are considered answers, and not questions.
    This swaps the semantics of the encoder used at query time.
    """

    documents_are_questions: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Documents inside this corpus are considered questions, and not answers.
    This swaps the semantics of the encoder used at indexing.
    """

    encoder_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The encoder used by the corpus.
    _Deprecated_: Use `encoder_name` instead
    """

    encoder_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The encoder used by the corpus.
    """

    filter_attributes: typing.Optional[typing.List[FilterAttribute]] = pydantic.Field(default=None)
    """
    The new filter attributes of the corpus.
    """

    custom_dimensions: typing.Optional[typing.List[CorpusCustomDimension]] = pydantic.Field(default=None)
    """
    The custom dimensions of all document parts inside the corpus.
    """

    limits: typing.Optional[CorpusLimits] = None
    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Indicates when the corpus was created.
    """

    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
