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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .address import Address
from .location_capability import LocationCapability
from .location_status import LocationStatus
from .country import Country
from .currency import Currency
from .location_type import LocationType
from .business_hours import BusinessHours
from .coordinates import Coordinates
from .tax_ids import TaxIds
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Location(UncheckedBaseModel):
    """
    Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api).
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    A short generated string of letters and numbers that uniquely identifies this location instance.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name of the location.
    This information appears in the Seller Dashboard as the nickname.
    A location name must be unique within a seller account.
    """

    address: typing.Optional[Address] = pydantic.Field(default=None)
    """
    The physical address of the location.
    """

    timezone: typing.Optional[str] = pydantic.Field(default=None)
    """
    The [IANA time zone](https://www.iana.org/time-zones) identifier for
    the time zone of the location. For example, `America/Los_Angeles`.
    """

    capabilities: typing.Optional[typing.List[LocationCapability]] = pydantic.Field(default=None)
    """
    The Square features that are enabled for the location.
    See [LocationCapability](entity:LocationCapability) for possible values.
    See [LocationCapability](#type-locationcapability) for possible values
    """

    status: typing.Optional[LocationStatus] = pydantic.Field(default=None)
    """
    The status of the location.
    See [LocationStatus](#type-locationstatus) for possible values
    """

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

    merchant_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the merchant that owns the location.
    """

    country: typing.Optional[Country] = pydantic.Field(default=None)
    """
    The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`.
    
    See [Country](entity:Country) for possible values.
    See [Country](#type-country) for possible values
    """

    language_code: typing.Optional[str] = pydantic.Field(default=None)
    """
    The language associated with the location, in
    [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A).
    For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences).
    """

    currency: typing.Optional[Currency] = pydantic.Field(default=None)
    """
    The currency used for all transactions at this location,
    in ISO 4217 format. For example, the currency code for US dollars is `USD`.
    See [Currency](entity:Currency) for possible values.
    See [Currency](#type-currency) for possible values
    """

    phone_number: typing.Optional[str] = pydantic.Field(default=None)
    """
    The phone number of the location. For example, `+1 855-700-6000`.
    """

    business_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period.
    """

    type: typing.Optional[LocationType] = pydantic.Field(default=None)
    """
    The type of the location.
    See [LocationType](#type-locationtype) for possible values
    """

    website_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The website URL of the location.  For example, `https://squareup.com`.
    """

    business_hours: typing.Optional[BusinessHours] = pydantic.Field(default=None)
    """
    The hours of operation for the location.
    """

    business_email: typing.Optional[str] = pydantic.Field(default=None)
    """
    The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    The description of the location. For example, `Main Street location`.
    """

    twitter_username: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Twitter username of the location without the '@' symbol. For example, `Square`.
    """

    instagram_username: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Instagram username of the location without the '@' symbol. For example, `square`.
    """

    facebook_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`.
    """

    coordinates: typing.Optional[Coordinates] = pydantic.Field(default=None)
    """
    The physical coordinates (latitude and longitude) of the location.
    """

    logo_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL of the logo image for the location. When configured in the Seller
    Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
    This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels.
    """

    pos_background_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL of the Point of Sale background image for the location.
    """

    mcc: typing.Optional[str] = pydantic.Field(default=None)
    """
    A four-digit number that describes the kind of goods or services sold at the location.
    The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245.
    For example, `5045`, for a location that sells computer goods and software.
    """

    full_format_logo_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL of a full-format logo image for the location. When configured in the Seller
    Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
    This image can be wider than it is tall and should be at least 1280x648 pixels.
    """

    tax_ids: typing.Optional[TaxIds] = pydantic.Field(default=None)
    """
    The tax IDs for this location.
    """

    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
