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

from __future__ import annotations
import dataclasses
import dateutil.parser
from ..shared import invoicelineitemparams as shared_invoicelineitemparams
from dataclasses_json import Undefined, dataclass_json
from datetime import datetime
from orb import utils
from typing import Optional


@dataclass_json(undefined=Undefined.EXCLUDE)

@dataclasses.dataclass
class CreateOneOffInvoiceParams:
    currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currency') }})
    r"""An ISO 4217 currency string. Must be the same as the customer's currency if it is set."""
    invoice_date: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoice_date'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse }})
    r"""Optional invoice date to set. Must be in the past, if not set, `invoice_date` is set to the current time in the customer's timezone."""
    line_items: list[shared_invoicelineitemparams.InvoiceLineItemParams] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('line_items') }})
    net_terms: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('net_terms') }})
    r"""Determines the difference between the invoice issue date for subscription invoices as the date that they are due. A value of '0' here represents that the invoice is due on issue, whereas a value of 30 represents that the customer has 30 days to pay the invoice."""
    customer_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('customer_id') }})
    r"""The id of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required."""
    external_customer_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('external_customer_id') }})
    r"""The `external_customer_id` of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required."""
    memo: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('memo') }})
    r"""An optional memo to attach to the invoice."""
    will_auto_issue: Optional[bool] = dataclasses.field(default=False, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('will_auto_issue'), 'exclude': lambda f: f is None }})
    r"""When true, this invoice will automatically be issued upon creation. When false, the resulting invoice will require manual review to issue. Defaulted to false."""
    

