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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
from .filter_attribute_level import FilterAttributeLevel
import typing
from .filter_attribute_type import FilterAttributeType
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class FilterAttribute(UniversalBaseModel):
    name: str = pydantic.Field()
    """
    The JSON path of the filter attribute in a document or document part metadata.
    """

    level: FilterAttributeLevel = pydantic.Field()
    """
    Indicates whether this a document or document part metadata filter.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Description of the filter. May be omitted.
    """

    indexed: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether an index is created for the filter. Creating an index will improve query latency when using the filter.
    """

    type: FilterAttributeType = pydantic.Field()
    """
    The value type of the filter.
    """

    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
