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

from __future__ import annotations
import dataclasses
import dateutil.parser
from ..shared import creditnoteitemobject as shared_creditnoteitemobject
from ..shared import customerobject as shared_customerobject
from dataclasses_json import Undefined, dataclass_json
from datetime import datetime
from enum import Enum
from marshmallow import fields
from sdk import utils
from typing import Optional

class CreditNoteObjectCreditStatusEnum(str, Enum):
    r"""Credit status"""
    AVAILABLE = 'available'
    CONSUMED = 'consumed'
    VOIDED = 'voided'

class CreditNoteObjectReasonEnum(str, Enum):
    r"""Reason"""
    DUPLICATED_CHARGE = 'duplicated_charge'
    PRODUCT_UNSATISFACTORY = 'product_unsatisfactory'
    ORDER_CHANGE = 'order_change'
    ORDER_CANCELLATION = 'order_cancellation'
    FRAUDULENT_CHARGE = 'fraudulent_charge'
    OTHER = 'other'

class CreditNoteObjectRefundStatusEnum(str, Enum):
    r"""Refund status"""
    PENDING = 'pending'
    SUCCEEDED = 'succeeded'
    FAILED = 'failed'


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class CreditNoteObject:
    
    balance_amount_cents: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('balance_amount_cents') }})  
    balance_amount_currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('balance_amount_currency') }})  
    created_at: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('created_at'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})  
    credit_amount_cents: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('credit_amount_cents') }})  
    credit_amount_currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('credit_amount_currency') }})  
    invoice_number: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoice_number') }})  
    issuing_date: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('issuing_date'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})  
    lago_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lago_id') }})  
    lago_invoice_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lago_invoice_id') }})  
    number: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('number') }})  
    reason: CreditNoteObjectReasonEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('reason') }})
    r"""Reason"""  
    refund_amount_cents: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('refund_amount_cents') }})  
    refund_amount_currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('refund_amount_currency') }})  
    sequential_id: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sequential_id') }})  
    sub_total_vat_excluded_amount_cents: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sub_total_vat_excluded_amount_cents') }})  
    sub_total_vat_excluded_amount_currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sub_total_vat_excluded_amount_currency') }})  
    total_amount_cents: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('total_amount_cents') }})  
    total_amount_currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('total_amount_currency') }})  
    updated_at: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('updated_at'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})  
    vat_amount_cents: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('vat_amount_cents') }})  
    vat_amount_currency: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('vat_amount_currency') }})  
    credit_status: Optional[CreditNoteObjectCreditStatusEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('credit_status'), 'exclude': lambda f: f is None }})
    r"""Credit status"""  
    customer: Optional[shared_customerobject.CustomerObject] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('customer'), 'exclude': lambda f: f is None }})  
    description: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('description'), 'exclude': lambda f: f is None }})  
    file_url: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('file_url'), 'exclude': lambda f: f is None }})  
    items: Optional[list[shared_creditnoteitemobject.CreditNoteItemObject]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('items'), 'exclude': lambda f: f is None }})  
    refund_status: Optional[CreditNoteObjectRefundStatusEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('refund_status'), 'exclude': lambda f: f is None }})
    r"""Refund status"""  
    