"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
from dataclasses_json import Undefined, dataclass_json
from dub import utils
from enum import Enum
from typing import Any, Dict, Optional


@dataclasses.dataclass
class TrackSaleGlobals:
    workspace_id: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'workspaceId', 'style': 'form', 'explode': True }})
    r"""Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible."""
    project_slug: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'projectSlug', 'style': 'form', 'explode': True }})
    r"""Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible."""
    



class PaymentProcessor(str, Enum):
    r"""The payment processor via which the sale was made."""
    STRIPE = 'stripe'
    SHOPIFY = 'shopify'
    PADDLE = 'paddle'


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class TrackSaleRequestBody:
    UNSET='__SPEAKEASY_UNSET__'
    customer_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('customerId') }})
    r"""This is the unique identifier for the customer in the client's app. This is used to track the customer's journey."""
    amount: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('amount') }})
    r"""The amount of the sale. Should be passed in cents."""
    payment_processor: PaymentProcessor = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('paymentProcessor') }})
    r"""The payment processor via which the sale was made."""
    event_name: Optional[str] = dataclasses.field(default='Purchase', metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('eventName'), 'exclude': lambda f: f is None }})
    r"""The name of the sale event. It can be used to track different types of event for example 'Purchase', 'Upgrade', 'Payment', etc."""
    invoice_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoiceId'), 'exclude': lambda f: f is TrackSaleRequestBody.UNSET }})
    r"""The invoice ID of the sale."""
    currency: Optional[str] = dataclasses.field(default='usd', metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currency'), 'exclude': lambda f: f is None }})
    r"""The currency of the sale. Accepts ISO 4217 currency codes."""
    metadata: Optional[Dict[str, Any]] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('metadata'), 'exclude': lambda f: f is TrackSaleRequestBody.UNSET }})
    r"""Additional metadata to be stored with the sale event."""
    



@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class TrackSaleResponseBody:
    r"""A sale was tracked."""
    event_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('eventName') }})
    customer_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('customerId') }})
    amount: float = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('amount') }})
    payment_processor: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('paymentProcessor') }})
    invoice_id: Optional[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoiceId') }})
    currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currency') }})
    metadata: Optional[Dict[str, Any]] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('metadata') }})
    

