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

from __future__ import annotations
from .dto_customerinvoicesummary import (
    DtoCustomerInvoiceSummary,
    DtoCustomerInvoiceSummaryTypedDict,
)
from flexprice.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict


class DtoCustomerMultiCurrencyInvoiceSummaryTypedDict(TypedDict):
    customer_id: NotRequired[str]
    r"""customer_id is the unique identifier of the customer"""
    default_currency: NotRequired[str]
    r"""default_currency is the primary currency for this customer"""
    summaries: NotRequired[List[DtoCustomerInvoiceSummaryTypedDict]]
    r"""summaries contains the invoice summaries for each currency"""


class DtoCustomerMultiCurrencyInvoiceSummary(BaseModel):
    customer_id: Optional[str] = None
    r"""customer_id is the unique identifier of the customer"""

    default_currency: Optional[str] = None
    r"""default_currency is the primary currency for this customer"""

    summaries: Optional[List[DtoCustomerInvoiceSummary]] = None
    r"""summaries contains the invoice summaries for each currency"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["customer_id", "default_currency", "summaries"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m
