# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from datetime import date, datetime

from pydantic import Field as FieldInfo

from ...._models import BaseModel
from .privacy_law import PrivacyLaw
from .carts.currency_object import CurrencyObject
from .customers.payment_method import PaymentMethod
from .marketing_consent_status import MarketingConsentStatus

__all__ = ["Customer", "CurrentRewardsTier", "RewardsBalance"]


class CurrentRewardsTier(BaseModel):
    id: Optional[int] = None

    api_type: Optional[str] = FieldInfo(alias="_type", default=None)

    name: Optional[str] = None


class RewardsBalance(BaseModel):
    balance: Optional[CurrencyObject] = None

    expiration_date: Optional[date] = FieldInfo(alias="expirationDate", default=None)
    """The expiration date of this voucher"""

    pending_balance: Optional[CurrencyObject] = FieldInfo(alias="pendingBalance", default=None)


class Customer(BaseModel):
    id: str
    """A customer public facing Id (String).

    "me" or a hashed string. ?customer=me and /customers/me/ are both magical
    customer identifiers, but they are customer identifiers nonetheless. They make
    the API easier to use than ?customer=c.dkd3kl238es or
    /customers/c.23i8fjdksdfs3.
    """

    api_type: str = FieldInfo(alias="_type")

    can_receive_sms: bool = FieldInfo(alias="canReceiveSms")
    """Whether or not the customer can be marketed to via SMS text messages."""

    credit_balance: CurrencyObject = FieldInfo(alias="creditBalance")

    date_created: datetime = FieldInfo(alias="dateCreated")

    email: str
    """Email address."""

    first_name: str = FieldInfo(alias="firstName")
    """First name of the TodayTix customer."""

    home_location_id: int = FieldInfo(alias="homeLocationId")
    """Numeric identifier for a resource"""

    last_name: str = FieldInfo(alias="lastName")
    """Last name of the TodayTix customer."""

    marketing_email_consent: MarketingConsentStatus = FieldInfo(alias="marketingEmailConsent")
    """
    Used to indicate the status of a user's consent to receive marketing
    communications from TodayTix. N.B. Clients may only set this to GRANTED or
    DENIED in POST/PATCH endpoints; only the backend can set this to UNDETERMINED.
    """

    privacy_law: PrivacyLaw = FieldInfo(alias="privacyLaw")
    """
    The privacy law by which a customer's personal data is protected. Different
    customers fall under different legal protection based on their home location,
    citizenship, etc. Laws include:

    - GDPR (General Data Protection & Regulation) for EU citizens & residents.
    - CA (California Consumer Privacy Act) for California residents.
    - CASL (Canada's Anti-Spam Law) for Canadians.
    - AUS (Australia's Privacy Act) for Australians.
    - NZ (New Zealand's Privacy Act) for New Zealanders.
    - CT (Connecticut's Privacy Act) for Connecticut residents.
    - VA (Virginia's Privacy Act) for Virginia residents.
    - UT (Utah's Privacy Act) for Utah residents.
    - CO (Colorado's Privacy Act) for Colorado residents.
    - NONE for customers not protected by any of the above.
    """

    apple_id: Optional[str] = FieldInfo(alias="appleId", default=None)
    """Apple auth user identifier, if this customer uses Sign in with Apple."""

    confirmed_email_addresses: Optional[List[str]] = FieldInfo(alias="confirmedEmailAddresses", default=None)
    """
    List of email addresses that are verified. Client needs to ask retype email
    address before make purchase or lottery entry if email not in this list.
    """

    country_code: Optional[str] = FieldInfo(alias="countryCode", default=None)
    """Country code."""

    current_rewards_tier: Optional[CurrentRewardsTier] = FieldInfo(alias="currentRewardsTier", default=None)

    default_payment_method: Optional[PaymentMethod] = FieldInfo(alias="defaultPaymentMethod", default=None)

    facebook_id: Optional[str] = FieldInfo(alias="facebookId", default=None)
    """Facebook Id of this customer if user login with facebook account (optional).

    (I don't think we need loginType anymore)
    """

    is_tier_change_locked: Optional[bool] = FieldInfo(alias="isTierChangeLocked", default=None)
    """Indicates whether the customer is blocked from changing reward tiers"""

    phone: Optional[str] = None
    """Phone number."""

    profile_image_url: Optional[str] = FieldInfo(alias="profileImageUrl", default=None)
    """
    A subset of `externalHref`, specific to images hosted by Imgix. This distinction
    is useful for clients, as it indicates that Imgix-specific query parameters may
    be used to resize or otherwise transform the requested image resource.
    """

    rewards_balance: Optional[RewardsBalance] = FieldInfo(alias="rewardsBalance", default=None)
    """Summary of a customer's reward voucher"""

    traits: Optional[object] = None
    """Computed segment user traits as a map.

    Segment API document
    https://segment-docs.netlify.app/docs/unify/profile-api/#get-a-profiles-traits
    This is only returned for GET customers/id
    """

    v1_token: Optional[str] = FieldInfo(alias="v1Token", default=None)
    """
    Customer Token for using api v1. This should be deprecated and removed, when all
    clients fully switched to v2 api.
    """
