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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from .entity_type import EntityType
from .scoped_entity import ScopedEntity


class KnowledgeContextFilter_ByEntities(UniversalBaseModel):
    scope_type: typing_extensions.Annotated[typing.Literal["byEntities"], FieldMetadata(alias="scopeType")] = (
        "byEntities"
    )
    entities: typing.List[ScopedEntity]

    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


class KnowledgeContextFilter_ByEntityTypes(UniversalBaseModel):
    scope_type: typing_extensions.Annotated[typing.Literal["byEntityTypes"], FieldMetadata(alias="scopeType")] = (
        "byEntityTypes"
    )
    entity_types: typing_extensions.Annotated[typing.Set[EntityType], FieldMetadata(alias="entityTypes")]

    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


KnowledgeContextFilter = typing.Union[KnowledgeContextFilter_ByEntities, KnowledgeContextFilter_ByEntityTypes]
