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

from __future__ import annotations
from ...core.pydantic_utilities import UniversalBaseModel
from ...commons.types.precondition_group import PreconditionGroup
import pydantic
from .knowledge_base_type import KnowledgeBaseType
import typing
from ...commons.types.precondition import Precondition
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.pydantic_utilities import update_forward_refs


class KnowledgeBaseProperties(UniversalBaseModel):
    name: str = pydantic.Field()
    """
    The name of the knowledge base
    """

    type: KnowledgeBaseType = pydantic.Field()
    """
    The type of the knowledge base. Can not be changed once created.
    """

    url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL to pull content from for RSS and URL knowledge bases.
    """

    precondition: typing.Optional[Precondition] = pydantic.Field(default=None)
    """
    (Beta) The preconditions that must be met for knowledge base be relevant to a conversation. Can be used to limit knowledge to certain types of users.
    """

    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


update_forward_refs(PreconditionGroup, KnowledgeBaseProperties=KnowledgeBaseProperties)
