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

from __future__ import annotations
from .billablefee import BillableFee, BillableFeeTypedDict
from .cardacquiringmodel import CardAcquiringModel
from .minimumcommitment import MinimumCommitment, MinimumCommitmentTypedDict
from .monthlyplatformfee import MonthlyPlatformFee, MonthlyPlatformFeeTypedDict
from datetime import datetime
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class FeePlanTypedDict(TypedDict):
    plan_id: str
    r"""A unique identifier for a Moov resource. Supports UUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) or typed format with base32-encoded UUID and type suffix (e.g., kuoaydiojf7uszaokc2ggnaaaa_xfer)."""
    name: str
    r"""The name of the fee plan."""
    card_acquiring_model: CardAcquiringModel
    r"""Specifies the card processing pricing model"""
    billable_fees: List[BillableFeeTypedDict]
    r"""Additional usage-based fees for this plan."""
    minimum_commitment: MinimumCommitmentTypedDict
    r"""The minimum spending amount that must be met in the billing period. If actual usage is below the minimum amount, account is charged the difference."""
    monthly_platform_fee: MonthlyPlatformFeeTypedDict
    r"""Fixed recurring amount paid in the billing period regardless of usage."""
    created_at: datetime
    description: NotRequired[str]
    r"""A description of the fee plan."""


class FeePlan(BaseModel):
    plan_id: Annotated[str, pydantic.Field(alias="planID")]
    r"""A unique identifier for a Moov resource. Supports UUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) or typed format with base32-encoded UUID and type suffix (e.g., kuoaydiojf7uszaokc2ggnaaaa_xfer)."""

    name: str
    r"""The name of the fee plan."""

    card_acquiring_model: Annotated[
        CardAcquiringModel, pydantic.Field(alias="cardAcquiringModel")
    ]
    r"""Specifies the card processing pricing model"""

    billable_fees: Annotated[List[BillableFee], pydantic.Field(alias="billableFees")]
    r"""Additional usage-based fees for this plan."""

    minimum_commitment: Annotated[
        MinimumCommitment, pydantic.Field(alias="minimumCommitment")
    ]
    r"""The minimum spending amount that must be met in the billing period. If actual usage is below the minimum amount, account is charged the difference."""

    monthly_platform_fee: Annotated[
        MonthlyPlatformFee, pydantic.Field(alias="monthlyPlatformFee")
    ]
    r"""Fixed recurring amount paid in the billing period regardless of usage."""

    created_at: Annotated[datetime, pydantic.Field(alias="createdAt")]

    description: Optional[str] = None
    r"""A description of the fee plan."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["description"])
        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


try:
    FeePlan.model_rebuild()
except NameError:
    pass
