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

import typing_extensions
from ..types.search_orders_sort_field import SearchOrdersSortField
import typing_extensions
from ..types.sort_order import SortOrder


class SearchOrdersSortParams(typing_extensions.TypedDict):
    """
    Sorting criteria for a `SearchOrders` request. Results can only be sorted
    by a timestamp field.
    """

    sort_field: SearchOrdersSortField
    """
    The field to sort by.
    
    __Important:__ When using a [DateTimeFilter](entity:SearchOrdersFilter),
    `sort_field` must match the timestamp field that the `DateTimeFilter` uses to
    filter. For example, if you set your `sort_field` to `CLOSED_AT` and you use a
    `DateTimeFilter`, your `DateTimeFilter` must filter for orders by their `CLOSED_AT` date.
    If this field does not match the timestamp field in `DateTimeFilter`,
    `SearchOrders` returns an error.
    
    Default: `CREATED_AT`.
    See [SearchOrdersSortField](#type-searchorderssortfield) for possible values
    """

    sort_order: typing_extensions.NotRequired[SortOrder]
    """
    The chronological order in which results are returned. Defaults to `DESC`.
    See [SortOrder](#type-sortorder) for possible values
    """
