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

from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal

from pydantic import Field as FieldInfo

from .ticket import Ticket
from .add_ons import AddOns
from .barcode import Barcode
from ...._models import BaseModel
from .price_item import PriceItem
from .seats_info import SeatsInfo
from .shows.showtime import Showtime
from .shows.admission_type import AdmissionType
from .carts.currency_object import CurrencyObject
from .carts.delivery_method import DeliveryMethod
from .eticket_delivery_time import EticketDeliveryTime
from .earned_rewards_summary import EarnedRewardsSummary
from .customers.minified_show import MinifiedShow
from .customers.payment_method import PaymentMethod
from .marketing_consent_status import MarketingConsentStatus
from .ticket_protection_summary import TicketProtectionSummary
from .customers.social_share_config import SocialShareConfig
from .customers.customer_service_info import CustomerServiceInfo

__all__ = ["Order", "AssignedCustomer", "Options", "Transfer", "TransferActionToken"]


class AssignedCustomer(BaseModel):
    email: Optional[str] = None
    """Email address."""

    first_name: Optional[str] = FieldInfo(alias="firstName", default=None)
    """First name of the TodayTix customer."""

    last_name: Optional[str] = FieldInfo(alias="lastName", default=None)
    """Last name of the TodayTix customer."""


class Options(BaseModel):
    api_type: str = FieldInfo(alias="_type")

    can_change_email: bool = FieldInfo(alias="canChangeEmail")
    """Whether the email address associated with the order can be changed."""

    can_change_pickup_name: bool = FieldInfo(alias="canChangePickupName")
    """Whether the pickup name associated with the order can be changed."""

    can_transfer: bool = FieldInfo(alias="canTransfer")
    """Whether the order can be transferred to another user."""

    supports_apple_pass: bool = FieldInfo(alias="supportsApplePass")
    """Whether the order supports Apple Pass."""

    supports_google_pass: bool = FieldInfo(alias="supportsGooglePass")
    """Whether the order supports Google Pass."""


class TransferActionToken(BaseModel):
    token: Optional[str] = None
    """Unique token used to identify this action"""

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

    action_type: Optional[Literal["ACCEPT_TRANSFER"]] = FieldInfo(alias="actionType", default=None)

    expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)


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

    action_token: Optional[TransferActionToken] = FieldInfo(alias="actionToken", default=None)

    status: Optional[Literal["PENDING", "ACCEPTED", "CANCELLED"]] = None

    url: Optional[str] = None


class Order(BaseModel):
    id: Optional[int] = None
    """Numeric identifier for a resource"""

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

    accessibility_text: Optional[str] = FieldInfo(alias="accessibilityText", default=None)
    """Text explaining how customers can obtain handicap-accessible tickets."""

    account_newsletter_consent: Optional[MarketingConsentStatus] = FieldInfo(
        alias="accountNewsletterConsent", default=None
    )
    """
    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.
    """

    add_ons: Optional[AddOns] = FieldInfo(alias="addOns", default=None)

    admission_type: Optional[AdmissionType] = FieldInfo(alias="admissionType", default=None)
    """
    The type of admission allowed for the Show. TIMED = regular theater performance,
    e.g. on date X at time Y. DATED = open-ended admission on a specific date, like
    a museum. OPEN = open-ended admission on any date, like a streamed performance.
    """

    allow_change_email: Optional[bool] = FieldInfo(alias="allowChangeEmail", default=None)
    """while true - user could modify email"""

    allow_change_pickup_name: Optional[bool] = FieldInfo(alias="allowChangePickupName", default=None)
    """while true - user could modify pickup name"""

    assigned_customers: Optional[List[AssignedCustomer]] = FieldInfo(alias="assignedCustomers", default=None)

    barcodes: Optional[List[Barcode]] = None
    """
    Array of barcodes for the tickets in this order. This is DEPRECATED and should
    be replaced by the `tickets` array.
    """

    barcode_type: Optional[str] = FieldInfo(alias="barcodeType", default=None)

    confirmation_number: Optional[str] = FieldInfo(alias="confirmationNumber", default=None)
    """Customer facing order confirmation number"""

    confirmation_text: Optional[str] = FieldInfo(alias="confirmationText", default=None)
    """Show this text after purchase on confirmation screen"""

    confirmation_text_for_mobile: Optional[str] = FieldInfo(alias="confirmationTextForMobile", default=None)
    """Show this text after purchase on confirmation screen and in calendar event"""

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

    customer_service_info: Optional[CustomerServiceInfo] = FieldInfo(alias="customerServiceInfo", default=None)
    """Customer service information to contact TodayTix by phone, mail, email, etc."""

    delivery_image_url: Optional[str] = FieldInfo(alias="deliveryImageUrl", default=None)
    """A link points to an external resource. For images we using IMGX.

    To get the right size see link "https://docs.imgix.com/apis/url/size"
    """

    delivery_instructions_text: Optional[str] = FieldInfo(alias="deliveryInstructionsText", default=None)
    """Show this text after purchase on confirmation screen and in calendar event"""

    delivery_instructions_title: Optional[str] = FieldInfo(alias="deliveryInstructionsTitle", default=None)
    """Show this text after purchase on confirmation screen as title text"""

    delivery_method: Optional[DeliveryMethod] = FieldInfo(alias="deliveryMethod", default=None)
    """How to pickup the tickets"""

    does_location_require_partner_opt_in: Optional[bool] = FieldInfo(
        alias="doesLocationRequirePartnerOptIn", default=None
    )
    """
    Whether or not this location requires that customers explicitly opt in to share
    their information with theater partners.
    """

    email: Optional[str] = None
    """Email address."""

    eticket_delivery_time: Optional[EticketDeliveryTime] = FieldInfo(alias="eticketDeliveryTime", default=None)
    """Different time formats for when the tickets are scheduled to be delivered"""

    existing_account_types: Optional[List[Literal["FACEBOOK", "EMAIL", "APPLE"]]] = FieldInfo(
        alias="existingAccountTypes", default=None
    )
    """
    A list of existing account types the current guest customer has (can be any
    combination of these values, including an empty array)
    """

    is_first_order: Optional[bool] = FieldInfo(alias="isFirstOrder", default=None)
    """Whether it is the first order for this customer."""

    num_seats: Optional[int] = FieldInfo(alias="numSeats", default=None)
    """number of tickets in order"""

    options: Optional[Options] = None

    part_two_show_datetime: Optional[datetime] = FieldInfo(alias="partTwoShowDatetime", default=None)
    """
    If this is a 2-part show, the datetime of the part 2 performance. Otherwise,
    null.
    """

    payment_method: Optional[PaymentMethod] = FieldInfo(alias="paymentMethod", default=None)

    pdf: Optional[str] = None
    """A link points to an external resource. For images we using IMGX.

    To get the right size see link "https://docs.imgix.com/apis/url/size"
    """

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

    pickup_name: Optional[str] = FieldInfo(alias="pickupName", default=None)
    """Participant's pickup name."""

    pre_discount_subtotal: Optional[CurrencyObject] = FieldInfo(alias="preDiscountSubtotal", default=None)

    pre_discount_subtotal_office: Optional[CurrencyObject] = FieldInfo(alias="preDiscountSubtotalOffice", default=None)

    price_items: Optional[List[PriceItem]] = FieldInfo(alias="priceItems", default=None)

    pub_id: Optional[str] = FieldInfo(alias="pubId", default=None)
    """public-facing customer id"""

    purchase_datetime: Optional[datetime] = FieldInfo(alias="purchaseDatetime", default=None)
    """Purchase datetime (nonnull, correct datetime format)"""

    rewards: Optional[EarnedRewardsSummary] = None
    """
    Rewards summary that includes information pertaining to the availability and
    amount of the calculated credit.
    """

    seats_info: Optional[SeatsInfo] = FieldInfo(alias="seatsInfo", default=None)
    """
    Information to highlight the seats being held / purchased. This is DEPRECATED
    and should be replaced by the information in the `tickets` array, which includes
    section/row/seat details of each ticket, as well as pricing and barcode
    information.
    """

    share_config: Optional[SocialShareConfig] = FieldInfo(alias="shareConfig", default=None)

    show: Optional[MinifiedShow] = None
    """
    Object representing a subset of properties of a 'Show' object. Used for
    LotteryEntry and Order API to get top-level show info in those contexts.
    """

    show_datetime: Optional[datetime] = FieldInfo(alias="showDatetime", default=None)
    """Showtime datetime (nonnull, correct datetime format)"""

    show_daypart: Optional[Literal["MATINEE", "EVENING"]] = FieldInfo(alias="showDaypart", default=None)
    """Day of time (nonnull)"""

    show_id: Optional[int] = FieldInfo(alias="showId", default=None)
    """Numeric identifier for a resource"""

    show_name: Optional[str] = FieldInfo(alias="showName", default=None)
    """The name of the show"""

    show_score_review_url: Optional[str] = FieldInfo(alias="showScoreReviewUrl", default=None)
    """A link points to an external resource. For images we using IMGX.

    To get the right size see link "https://docs.imgix.com/apis/url/size"
    """

    showtime: Optional[Showtime] = None

    showtime_id: Optional[int] = FieldInfo(alias="showtimeId", default=None)
    """Numeric identifier for a resource"""

    status: Optional[Literal["REFUNDED", "PENDING", "CHARGED"]] = None
    """Status of Order.

    REFUNDED it is the same as Cancelled. PENDING and CHARGED are the same from user
    perspective.
    """

    supports_apple_pass: Optional[str] = FieldInfo(alias="supportsApplePass", default=None)
    """Barcode is supported by Apple Pass"""

    supports_google_pass: Optional[str] = FieldInfo(alias="supportsGooglePass", default=None)
    """Barcode is supported by Google Pass"""

    ticket_protection: Optional[TicketProtectionSummary] = FieldInfo(alias="ticketProtection", default=None)
    """Only available for AllocatedSeat.type = PURCHASE"""

    ticket_protection_redemption_status: Optional[Literal["ELIGIBLE", "EXPIRED", "REDEEMED", "NOT_ELIGIBLE"]] = (
        FieldInfo(alias="ticketProtectionRedemptionStatus", default=None)
    )
    """The status of the ticketProtection"""

    tickets: Optional[List[Ticket]] = None

    tickets_office: Optional[List[Ticket]] = FieldInfo(alias="ticketsOffice", default=None)
    """
    This object is similar to the `tickets` object, but all currency values are
    represented in the office currency instead of the local currency.
    """

    total: Optional[CurrencyObject] = None

    total_office: Optional[CurrencyObject] = FieldInfo(alias="totalOffice", default=None)

    transfer: Optional[Transfer] = None

    valediction_text: Optional[str] = FieldInfo(alias="valedictionText", default=None)
    """Show this text after purchase on confirmation screen"""

    voucher_code: Optional[str] = FieldInfo(alias="voucherCode", default=None)
    """Shows a valid voucher code used to make a purchase otherwise returns null"""

    was_transferred_out: Optional[bool] = FieldInfo(alias="wasTransferredOut", default=None)
    """
    Whether the order was successfully transferred to another user, with the current
    customer as the sender.
    """
