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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
from .customer_filter import CustomerFilter
import pydantic
from .customer_sort import CustomerSort
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CustomerQuery(UncheckedBaseModel):
    """
    Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request.
    """

    filter: typing.Optional[CustomerFilter] = pydantic.Field(default=None)
    """
    The filtering criteria for the search query. A query can contain multiple filters in any combination.
    Multiple filters are combined as `AND` statements.
    
    __Note:__ Combining multiple filters as `OR` statements is not supported. Instead, send multiple single-filter
    searches and join the result sets.
    """

    sort: typing.Optional[CustomerSort] = pydantic.Field(default=None)
    """
    Sorting criteria for query results. The default behavior is to sort 
    customers alphabetically by `given_name` and `family_name`.
    """

    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
