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

from __future__ import annotations
from .billablefee import BillableFee, BillableFeeTypedDict
from .cardacquiringmodel import CardAcquiringModel
from .feeplanagreementstatus import FeePlanAgreementStatus
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 PartnerPricingAgreementTypedDict(TypedDict):
    agreement_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)."""
    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 agreement."""
    accepted_on: datetime
    status: FeePlanAgreementStatus
    card_acquiring_model: CardAcquiringModel
    r"""Specifies the card processing pricing model"""
    billable_fees: List[BillableFeeTypedDict]
    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."""
    revenue_share: str
    r"""The decimal-formatted numerical string of the revenue split for partner.

    For example, 2.25% is '2.25'.
    """
    account_id: NotRequired[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)."""
    description: NotRequired[str]
    r"""The description of the agreement."""


class PartnerPricingAgreement(BaseModel):
    agreement_id: Annotated[str, pydantic.Field(alias="agreementID")]
    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)."""

    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 agreement."""

    accepted_on: Annotated[datetime, pydantic.Field(alias="acceptedOn")]

    status: FeePlanAgreementStatus

    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")]

    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."""

    revenue_share: Annotated[str, pydantic.Field(alias="revenueShare")]
    r"""The decimal-formatted numerical string of the revenue split for partner.

    For example, 2.25% is '2.25'.
    """

    account_id: Annotated[Optional[str], pydantic.Field(alias="accountID")] = None
    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)."""

    description: Optional[str] = None
    r"""The description of the agreement."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["accountID", "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:
    PartnerPricingAgreement.model_rebuild()
except NameError:
    pass
