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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .country import Country
from .currency import Currency
from .merchant_status import MerchantStatus
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Merchant(UncheckedBaseModel):
    """
    Represents a business that sells with Square.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-issued ID of the merchant.
    """

    business_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name of the merchant's overall business.
    """

    country: Country = pydantic.Field()
    """
    The country code associated with the merchant, in the two-letter format of ISO 3166. For example, `US` or `JP`.
    See [Country](#type-country) for possible values
    """

    language_code: typing.Optional[str] = pydantic.Field(default=None)
    """
    The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`.
    """

    currency: typing.Optional[Currency] = pydantic.Field(default=None)
    """
    The currency associated with the merchant, in ISO 4217 format. For example, the currency code for US dollars is `USD`.
    See [Currency](#type-currency) for possible values
    """

    status: typing.Optional[MerchantStatus] = pydantic.Field(default=None)
    """
    The merchant's status.
    See [MerchantStatus](#type-merchantstatus) for possible values
    """

    main_location_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The time when the merchant was created, in RFC 3339 format.
       For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
    """

    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
