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

from typing import Optional
from datetime import date
from typing_extensions import Literal

from pydantic import Field as FieldInfo

from ...._models import BaseModel

__all__ = ["Voucher", "Campaign"]


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

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

    name: str
    """The name of the voucher campaign"""


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

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

    amount: float
    """A monetary amount with 2 decimal places of precision. N.B.

    In some cases, this may be used to represent percentages (for fees, commissions,
    etc.), where `0.10` would represent 10%.
    """

    campaign: Campaign

    discount_type: Literal["FLAT", "PERCENT", "NO_FEE"] = FieldInfo(alias="discountType")
    """The voucher discount type"""

    is_declining_balance: bool = FieldInfo(alias="isDecliningBalance")
    """Whether the voucher is declining balance or not."""

    type: Literal[
        "AFFINITY",
        "CANCELLATION",
        "EXCHANGE",
        "GIFTCARD",
        "HOSPITALITY",
        "MARKETING_ACQUISITION",
        "MARKETING_RETENTION",
        "NET_RETAILER",
        "PARTNER_SUBSIDY",
        "PROMOTION",
    ]
    """The voucher type enum."""

    type_code: str = FieldInfo(alias="typeCode")
    """The 1 or 2-letter abbreviation for the voucher type enum."""

    balance: Optional[float] = None
    """A monetary amount with 2 decimal places of precision. N.B.

    In some cases, this may be used to represent percentages (for fees, commissions,
    etc.), where `0.10` would represent 10%.
    """

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