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

from __future__ import annotations
from abbyy_document_ai.types import BaseModel
from datetime import date
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class CustomerTypedDict(TypedDict):
    r"""Customer information"""

    customer_id_as_printed: NotRequired[str]
    r"""The client/customer identifier in the document"""
    name: NotRequired[str]
    r"""Information about the customer sending the remittance advice"""
    address: NotRequired[str]
    r"""Customer address information"""


class Customer(BaseModel):
    r"""Customer information"""

    customer_id_as_printed: Annotated[
        Optional[str], pydantic.Field(alias="customerIdAsPrinted")
    ] = None
    r"""The client/customer identifier in the document"""

    name: Optional[str] = None
    r"""Information about the customer sending the remittance advice"""

    address: Optional[str] = None
    r"""Customer address information"""


class RemittanceAdviceFieldsVendorTypedDict(TypedDict):
    r"""Vendor information"""

    vendor_id_as_printed: NotRequired[str]
    r"""The vendor's identifier in the document"""
    name: NotRequired[str]
    r"""Information about the vendor receiving the remittance advice"""
    address: NotRequired[str]
    r"""Vendor address information"""


class RemittanceAdviceFieldsVendor(BaseModel):
    r"""Vendor information"""

    vendor_id_as_printed: Annotated[
        Optional[str], pydantic.Field(alias="vendorIdAsPrinted")
    ] = None
    r"""The vendor's identifier in the document"""

    name: Optional[str] = None
    r"""Information about the vendor receiving the remittance advice"""

    address: Optional[str] = None
    r"""Vendor address information"""


class PaymentInformationTypedDict(TypedDict):
    r"""Payment information details"""

    payment_number: NotRequired[str]
    r"""The payment registration or invoice number"""
    payment_date: NotRequired[date]
    r"""The payment or invoice date"""
    payment_amount: NotRequired[float]
    r"""The payment amount"""
    currency: NotRequired[str]
    r"""The currency of the payment"""


class PaymentInformation(BaseModel):
    r"""Payment information details"""

    payment_number: Annotated[Optional[str], pydantic.Field(alias="paymentNumber")] = (
        None
    )
    r"""The payment registration or invoice number"""

    payment_date: Annotated[Optional[date], pydantic.Field(alias="paymentDate")] = None
    r"""The payment or invoice date"""

    payment_amount: Annotated[
        Optional[float], pydantic.Field(alias="paymentAmount")
    ] = None
    r"""The payment amount"""

    currency: Optional[str] = None
    r"""The currency of the payment"""


class RemittanceAdviceFieldsLineItemsTypedDict(TypedDict):
    r"""Line item details"""

    invoice_number: NotRequired[str]
    r"""The number of the invoice"""
    invoice_date: NotRequired[date]
    r"""The date on which the invoice was issued"""
    paid_amount: NotRequired[float]
    r"""The total invoice amount paid"""
    invoice_amount: NotRequired[float]
    r"""The total invoice amount"""
    discount: NotRequired[float]
    r"""The discount applicable to the invoice amount"""
    type: NotRequired[str]
    r"""The invoice type (Debit or Credit)"""
    customer_id: NotRequired[str]
    r"""The client/customer identifier"""


class RemittanceAdviceFieldsLineItems(BaseModel):
    r"""Line item details"""

    invoice_number: Annotated[Optional[str], pydantic.Field(alias="invoiceNumber")] = (
        None
    )
    r"""The number of the invoice"""

    invoice_date: Annotated[Optional[date], pydantic.Field(alias="invoiceDate")] = None
    r"""The date on which the invoice was issued"""

    paid_amount: Annotated[Optional[float], pydantic.Field(alias="paidAmount")] = None
    r"""The total invoice amount paid"""

    invoice_amount: Annotated[
        Optional[float], pydantic.Field(alias="invoiceAmount")
    ] = None
    r"""The total invoice amount"""

    discount: Optional[float] = None
    r"""The discount applicable to the invoice amount"""

    type: Optional[str] = None
    r"""The invoice type (Debit or Credit)"""

    customer_id: Annotated[Optional[str], pydantic.Field(alias="customerId")] = None
    r"""The client/customer identifier"""


class RemittanceAdviceFieldsTypedDict(TypedDict):
    r"""Fields extracted from a remittance advice"""

    customer: NotRequired[CustomerTypedDict]
    r"""Customer information"""
    vendor: NotRequired[RemittanceAdviceFieldsVendorTypedDict]
    r"""Vendor information"""
    payment_information: NotRequired[PaymentInformationTypedDict]
    r"""Payment information details"""
    total: NotRequired[float]
    r"""The total amount paid"""
    bank_key: NotRequired[str]
    r"""The bank identifier. This field is optional and may have the name of the bank as its value if no bank identifier is found"""
    line_items: NotRequired[List[RemittanceAdviceFieldsLineItemsTypedDict]]
    r"""Array of line items in the remittance advice"""


class RemittanceAdviceFields(BaseModel):
    r"""Fields extracted from a remittance advice"""

    customer: Optional[Customer] = None
    r"""Customer information"""

    vendor: Optional[RemittanceAdviceFieldsVendor] = None
    r"""Vendor information"""

    payment_information: Annotated[
        Optional[PaymentInformation], pydantic.Field(alias="paymentInformation")
    ] = None
    r"""Payment information details"""

    total: Optional[float] = None
    r"""The total amount paid"""

    bank_key: Annotated[Optional[str], pydantic.Field(alias="bankKey")] = None
    r"""The bank identifier. This field is optional and may have the name of the bank as its value if no bank identifier is found"""

    line_items: Annotated[
        Optional[List[RemittanceAdviceFieldsLineItems]],
        pydantic.Field(alias="lineItems"),
    ] = None
    r"""Array of line items in the remittance advice"""
