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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
from .customer_sort_field import CustomerSortField
import pydantic
from .sort_order import SortOrder
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CustomerSort(UncheckedBaseModel):
    """
    Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort
    customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results.
    """

    field: typing.Optional[CustomerSortField] = pydantic.Field(default=None)
    """
    Indicates the fields to use as the sort key, which is either the default set of fields or `created_at`.
    
    The default value is `DEFAULT`.
    See [CustomerSortField](#type-customersortfield) for possible values
    """

    order: typing.Optional[SortOrder] = pydantic.Field(default=None)
    """
    Indicates the order in which results should be sorted based on the
    sort field value. Strings use standard alphabetic comparison
    to determine order. Strings representing numbers are sorted as strings.
    
    The default value is `ASC`.
    See [SortOrder](#type-sortorder) for possible values
    """

    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
