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

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

from pydantic import Field as FieldInfo

from ..rewards import Rewards
from ....._models import BaseModel
from .ticket_info import TicketInfo
from .admission_type import AdmissionType
from ..carts.currency_object import CurrencyObject

__all__ = ["Showtime", "LotteryTickets", "RegularTickets", "RegularTicketsPriceBand", "RushTickets"]


class LotteryTickets(TicketInfo):
    available_after: Optional[_datetime.datetime] = FieldInfo(alias="availableAfter", default=None)
    """
    (Inclusive) Datetime when lottery will be opened for for entry. Client will use
    this to find when next lottery will be available.
    """

    available_after_epoch: Optional[int] = FieldInfo(alias="availableAfterEpoch", default=None)
    """The epoch time representation of a date-time."""

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

    lottery_group_title: Optional[str] = FieldInfo(alias="lotteryGroupTitle", default=None)
    """The title of the LotteryGroup for this showtime, if there is one."""


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

    face_value: Optional[float] = FieldInfo(alias="faceValue", default=None)
    """The face value of the associated price."""

    max_contiguous_seats: Optional[float] = FieldInfo(alias="maxContiguousSeats", default=None)
    """The maximum number of contiguous seats"""

    num_assigned_seats_available: Optional[float] = FieldInfo(alias="numAssignedSeatsAvailable", default=None)
    """The number of available assigned seats"""

    price: Optional[float] = None
    """The price of the tickets"""

    price_with_rewards_discount: Optional[CurrencyObject] = FieldInfo(alias="priceWithRewardsDiscount", default=None)
    """The price with the rewards discount percent applied (if applicable)."""


class RegularTickets(TicketInfo):
    availability_level: Optional[Literal["LOW"]] = FieldInfo(alias="availabilityLevel", default=None)
    """The level of availability left for the showtime"""

    calendar_fee_text: Optional[str] = FieldInfo(alias="calendarFeeText", default=None)
    """
    Text used by clients to display on calendar slide up for
    Location.includeFeesType = INVENTORY_APIS_ONLY and showtime with fees, otherwise
    it is null
    """

    discount: Optional[int] = None
    """Highest discount in % for this showtime."""

    has_no_booking_fee: Optional[bool] = FieldInfo(alias="hasNoBookingFee", default=None)
    """
    Whether or not this showtime has at least 1 allocation that qualifies as a no
    booking fee offer.
    """

    has_promotion: Optional[bool] = FieldInfo(alias="hasPromotion", default=None)
    """Whether or not this showtime has at least 1 allocation that is a promotion."""

    low_price: Optional[CurrencyObject] = FieldInfo(alias="lowPrice", default=None)  # type: ignore

    low_price_face_value: Optional[CurrencyObject] = FieldInfo(alias="lowPriceFaceValue", default=None)
    """The face value of the lowest-priced tickets for this listingType and showtime"""

    low_price_for_showtime_selection: Optional[CurrencyObject] = FieldInfo(
        alias="lowPriceForShowtimeSelection", default=None
    )

    price_bands: Optional[List[RegularTicketsPriceBand]] = FieldInfo(alias="priceBands", default=None)
    """The price bands for this showtime.

    This is a list of all price bands that are available for this showtime.
    """

    price_with_rewards_discount: Optional[CurrencyObject] = FieldInfo(alias="priceWithRewardsDiscount", default=None)
    """The lowest price with the rewards discount percent applied."""

    promotion_label: Optional[str] = FieldInfo(alias="promotionLabel", default=None)
    """The label for the active promotion."""

    rewards: Optional[Rewards] = None

    total_low_price: Optional[CurrencyObject] = FieldInfo(alias="totalLowPrice", default=None)

    total_low_price_for_showtime_selection: Optional[CurrencyObject] = FieldInfo(
        alias="totalLowPriceForShowtimeSelection", default=None
    )


class RushTickets(TicketInfo):
    available_after: Optional[_datetime.datetime] = FieldInfo(alias="availableAfter", default=None)
    """
    Datetime when rush will be opened (available) for this showtime. Client will use
    this to find when next rush tickets will be available for sale.
    """

    available_after_epoch: Optional[int] = FieldInfo(alias="availableAfterEpoch", default=None)
    """The epoch time representation of a date-time."""

    max_contiguous_seats: Optional[int] = FieldInfo(alias="maxContiguousSeats", default=None)
    """Max contiguous seats available"""

    quantity_available: Optional[int] = FieldInfo(alias="quantityAvailable", default=None)
    """
    Number of tickets available for sale. Client displays how many tickets left in
    real time.
    """

    quantity_held: Optional[int] = FieldInfo(alias="quantityHeld", default=None)
    """Number of tickets held for this showtime. All tickets in other user's carts."""


class Showtime(BaseModel):
    id: int
    """Numeric identifier for a resource"""

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

    admission_type: AdmissionType = FieldInfo(alias="admissionType")
    """
    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.
    """

    datetime: _datetime.datetime
    """Showtime datetime (nonnull, correct datetime format)"""

    datetime_epoch: int = FieldInfo(alias="datetimeEpoch")
    """The epoch time representation of a date-time."""

    day_of_week: Literal["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"] = FieldInfo(
        alias="dayOfWeek"
    )
    """The showtime's day of week"""

    daypart: Literal["MATINEE", "EVENING"]
    """Matinée vs evening"""

    local_date: _datetime.date = FieldInfo(alias="localDate")
    """A local date (in the format yyyy-MM-dd)."""

    local_time: str = FieldInfo(alias="localTime")
    """A local time (in the format hh:mm:ss)."""

    lottery_tickets: LotteryTickets = FieldInfo(alias="lotteryTickets")

    num_days_out: int = FieldInfo(alias="numDaysOut")
    """
    The number of days in between today (in the show's local timezone) and the
    showtime's local date.
    """

    regular_tickets: RegularTickets = FieldInfo(alias="regularTickets")

    rush_tickets: RushTickets = FieldInfo(alias="rushTickets")

    end_datetime: Optional[_datetime.datetime] = FieldInfo(alias="endDatetime", default=None)
    """Showtime's end datetime"""

    end_datetime_epoch: Optional[int] = FieldInfo(alias="endDatetimeEpoch", default=None)
    """The epoch time representation of a date-time."""

    end_local_date: Optional[_datetime.date] = FieldInfo(alias="endLocalDate", default=None)
    """A local date (in the format yyyy-MM-dd)."""

    end_local_time: Optional[str] = FieldInfo(alias="endLocalTime", default=None)
    """A local time (in the format hh:mm:ss)."""

    part_two_datetime: Optional[_datetime.datetime] = FieldInfo(alias="partTwoDatetime", default=None)
    """The date-time of the part two performance, if there is one."""

    part_two_datetime_epoch: Optional[int] = FieldInfo(alias="partTwoDatetimeEpoch", default=None)
    """The epoch time representation of a date-time."""

    provider_showtime_id: Optional[str] = FieldInfo(alias="providerShowtimeId", default=None)
    """The showtime id from the provider"""
