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

from ..core.unchecked_base_model import UncheckedBaseModel
from .invoice_filter import InvoiceFilter
import pydantic
import typing
from .invoice_sort import InvoiceSort
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class InvoiceQuery(UncheckedBaseModel):
    """
    Describes query criteria for searching invoices.
    """

    filter: InvoiceFilter = pydantic.Field()
    """
    Query filters to apply in searching invoices. 
    For more information, see [Search for invoices](https://developer.squareup.com/docs/invoices-api/retrieve-list-search-invoices#search-invoices).
    """

    sort: typing.Optional[InvoiceSort] = pydantic.Field(default=None)
    """
    Describes the sort order for the search result.
    """

    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
