"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from moovio_sdk.models.components import (
    amountdecimalvalidationerror as components_amountdecimalvalidationerror,
    createinvoicelineitemsvalidationerror as components_createinvoicelineitemsvalidationerror,
)
from moovio_sdk.models.errors import MoovError
from moovio_sdk.types import BaseModel
import pydantic
from typing import Optional
from typing_extensions import Annotated


class CreateInvoiceErrorData(BaseModel):
    customer_account_id: Annotated[
        Optional[str], pydantic.Field(alias="customerAccountID")
    ] = None
    description: Optional[str] = None
    line_items: Annotated[
        Optional[
            components_createinvoicelineitemsvalidationerror.CreateInvoiceLineItemsValidationError
        ],
        pydantic.Field(alias="lineItems"),
    ] = None
    invoice_date: Annotated[Optional[str], pydantic.Field(alias="invoiceDate")] = None
    due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = None
    tax_amount: Annotated[
        Optional[components_amountdecimalvalidationerror.AmountDecimalValidationError],
        pydantic.Field(alias="taxAmount"),
    ] = None


@dataclass(unsafe_hash=True)
class CreateInvoiceError(MoovError):
    data: CreateInvoiceErrorData = field(hash=False)

    def __init__(
        self,
        data: CreateInvoiceErrorData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        message = body or raw_response.text
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)
