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

from __future__ import annotations
import dataclasses
from ..shared import incrementcreditledgerentryinvoicesettings as shared_incrementcreditledgerentryinvoicesettings
from dataclasses_json import Undefined, dataclass_json
from datetime import date
from enum import Enum
from orb import utils
from typing import Optional, Union



@dataclasses.dataclass
class AddIncrementCreditLedgerEntryRequestParamsAmount:
    pass

class AddIncrementCreditLedgerEntryRequestParamsEntryType(str, Enum):
    INCREMENT = 'increment'



@dataclasses.dataclass
class AddIncrementCreditLedgerEntryRequestParamsMetadata:
    r"""User-specified key/value pairs for the ledger entry resource."""
    



@dataclass_json(undefined=Undefined.EXCLUDE)

@dataclasses.dataclass
class AddIncrementCreditLedgerEntryRequestParams:
    amount: Union[float, str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('amount') }})
    r"""The number of credits to effect. Note that this is required for increment, decrement, void, or undo operations."""
    entry_type: AddIncrementCreditLedgerEntryRequestParamsEntryType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('entry_type') }})
    description: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('description') }})
    r"""Optional metadata that can be specified when adding ledger results via the API. For example, this can be used to note an increment refers to trial credits, or for noting corrections as a result of an incident, etc."""
    effective_date: Optional[date] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('effective_date'), 'encoder': utils.dateisoformat(True), 'decoder': utils.datefromisoformat }})
    r"""A future date (specified in YYYY-MM-DD format) that denotes when this credit balance should become available for use."""
    expiry_date: Optional[date] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('expiry_date'), 'encoder': utils.dateisoformat(True), 'decoder': utils.datefromisoformat }})
    r"""A future date (specified in YYYY-MM-DD format) that denotes when this credit balance should expire."""
    invoice_settings: Optional[shared_incrementcreditledgerentryinvoicesettings.IncrementCreditLedgerEntryInvoiceSettings] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoice_settings') }})
    r"""Passing `invoice_settings` automatically generates an invoice for the newly added credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the calculation of the invoice total is done on that basis."""
    metadata: Optional[AddIncrementCreditLedgerEntryRequestParamsMetadata] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('metadata'), 'exclude': lambda f: f is None }})
    r"""User-specified key/value pairs for the ledger entry resource."""
    per_unit_cost_basis: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('per_unit_cost_basis') }})
    r"""Can only be specified when entry_type=increment. How much, in USD, a customer paid for a single credit in this block"""
    

