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

from __future__ import annotations
from .accountupdateroptions import AccountUpdaterOptions, AccountUpdaterOptionsTypedDict
from .adyencardoptions import AdyenCardOptions, AdyenCardOptionsTypedDict
from .adyenoptions import AdyenOptions, AdyenOptionsTypedDict
from .adyensepaoptions import AdyenSepaOptions, AdyenSepaOptionsTypedDict
from .affirmoptions import AffirmOptions, AffirmOptionsTypedDict
from .braintreeoptions import BraintreeOptions, BraintreeOptionsTypedDict
from .cybersourceantifraudoptions import (
    CybersourceAntiFraudOptions,
    CybersourceAntiFraudOptionsTypedDict,
)
from .cybersourceoptions import CybersourceOptions, CybersourceOptionsTypedDict
from .dlocaloptions import DlocalOptions, DlocalOptionsTypedDict
from .dlocalupioptions import DlocalUPIOptions, DlocalUPIOptionsTypedDict
from .fiservoptions import FiservOptions, FiservOptionsTypedDict
from .forterantifraudoptions import (
    ForterAntiFraudOptions,
    ForterAntiFraudOptionsTypedDict,
)
from .givingblockoptions import GivingBlockOptions, GivingBlockOptionsTypedDict
from .latitudeoptions import LatitudeOptions, LatitudeOptionsTypedDict
from .mattildatapioptions import MattildaTapiOptions, MattildaTapiOptionsTypedDict
from .mockcardoptions import MockCardOptions, MockCardOptionsTypedDict
from .nuveioptions import NuveiOptions, NuveiOptionsTypedDict
from .nuveipseoptions import NuveiPSEOptions, NuveiPSEOptionsTypedDict
from .oxxooptions import OxxoOptions, OxxoOptionsTypedDict
from .paypaloptions import PaypalOptions, PaypalOptionsTypedDict
from .powertranzoptions import PowertranzOptions, PowertranzOptionsTypedDict
from .stripeoptions import StripeOptions, StripeOptionsTypedDict
from .travelhuboptions import TravelhubOptions, TravelhubOptionsTypedDict
from .trustlyoptions import TrustlyOptions, TrustlyOptionsTypedDict
from .wpayeverdaypayoptions import WpayEverdaypayOptions, WpayEverdaypayOptionsTypedDict
from .wpaypaytooptions import WpayPaytoOptions, WpayPaytoOptionsTypedDict
from gr4vy.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing_extensions import Annotated, NotRequired, TypedDict


class TransactionConnectionOptionsTypedDict(TypedDict):
    account_updater: NotRequired[Nullable[AccountUpdaterOptionsTypedDict]]
    r"""Custom options to be passed to the `account-updater` connector, allowing for simulating different account updater responses."""
    adyen_afterpay: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-afterpay` connector."""
    adyen_alipay: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-alipay` connector."""
    adyen_card: NotRequired[Nullable[AdyenCardOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-card` connector."""
    adyen_cashapp: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-cashapp` connector."""
    adyen_giropay: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-giropay` connector."""
    adyen_ideal: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-ideal` connector."""
    adyen_sepa: NotRequired[Nullable[AdyenSepaOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-sepa` connector."""
    adyen_sofort: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-sofort` connector."""
    adyen_vipps: NotRequired[Nullable[AdyenOptionsTypedDict]]
    r"""Custom options to be passed to the `adyen-vipps` connector."""
    affirm_affirm: NotRequired[Nullable[AffirmOptionsTypedDict]]
    r"""Custom options to be passed to the `affirm-affirm` connector."""
    braintree_card: NotRequired[Nullable[BraintreeOptionsTypedDict]]
    r"""Custom options to be passed to the `braintree-card` connector."""
    cybersource_anti_fraud: NotRequired[Nullable[CybersourceAntiFraudOptionsTypedDict]]
    r"""Custom options to be passed to the `cybersource-anti-fraud` connector."""
    cybersource_card: NotRequired[Nullable[CybersourceOptionsTypedDict]]
    r"""Custom options to be passed to the `cybersource-card` connector."""
    cybersource_ideal: NotRequired[Nullable[CybersourceOptionsTypedDict]]
    r"""Custom options to be passed to the `cybersource-ideal` connector."""
    cybersource_kcp: NotRequired[Nullable[CybersourceOptionsTypedDict]]
    r"""Custom options to be passed to the `cybersource-kcp` connector."""
    dlocal_nequi: NotRequired[Nullable[DlocalOptionsTypedDict]]
    r"""Custom options to be passed to the `dlocal-nequi` connector."""
    dlocal_upi: NotRequired[Nullable[DlocalUPIOptionsTypedDict]]
    r"""Custom options to be passed to the `dlocal-upi` connector."""
    fiserv_card: NotRequired[Nullable[FiservOptionsTypedDict]]
    r"""Custom options to be passed to the `fiserv-card` connector."""
    forter_anti_fraud: NotRequired[Nullable[ForterAntiFraudOptionsTypedDict]]
    r"""Custom options to be passed to the `forter-anti-fraud` connector."""
    gem_gem: NotRequired[Nullable[LatitudeOptionsTypedDict]]
    r"""Custom options to be passed to the `gem-gem` connector."""
    gem_gemds: NotRequired[Nullable[LatitudeOptionsTypedDict]]
    r"""Custom options to be passed to the `gem-gemds` connector."""
    givingblock_givingblock: NotRequired[Nullable[GivingBlockOptionsTypedDict]]
    r"""Custom options to be passed to the `givingblock-givingblock` connector."""
    latitude_latitude: NotRequired[Nullable[LatitudeOptionsTypedDict]]
    r"""Custom options to be passed to the `latitude-latitude` connector."""
    latitude_latitudeds: NotRequired[Nullable[LatitudeOptionsTypedDict]]
    r"""Custom options to be passed to the `latitude-latitudeds` connector."""
    mattilda_tapi: NotRequired[Nullable[MattildaTapiOptionsTypedDict]]
    r"""Custom options to be passed to the `mattilda-tapi` connector."""
    mattilda_tapifintechs: NotRequired[Nullable[MattildaTapiOptionsTypedDict]]
    r"""Custom options to be passed to the `mattilda-tapifintechs` connector."""
    mock_card: NotRequired[Nullable[MockCardOptionsTypedDict]]
    r"""Custom options to be passed to the `mock-card` connector."""
    nuvei_card: NotRequired[Nullable[NuveiOptionsTypedDict]]
    r"""Custom options to be passed to the `nuvei-card` connector."""
    nuvei_pse: NotRequired[Nullable[NuveiPSEOptionsTypedDict]]
    r"""Custom options to be passed to the `nuvei-pse` connector."""
    oxxo_oxxo: NotRequired[Nullable[OxxoOptionsTypedDict]]
    r"""Custom options to be passed to the `oxxo-oxxo` connector."""
    paypal_paypal: NotRequired[Nullable[PaypalOptionsTypedDict]]
    r"""Custom options to be passed to the `paypal-paypal` connector."""
    paypal_paypalpaylater: NotRequired[Nullable[PaypalOptionsTypedDict]]
    r"""Custom options to be passed to the `paypal-paypalpaylater` connector."""
    powertranz_card: NotRequired[Nullable[PowertranzOptionsTypedDict]]
    r"""Custom options to be passed to the `powertranz-card` connector."""
    stripe_card: NotRequired[Nullable[StripeOptionsTypedDict]]
    r"""Custom options to be passed to the `stripe-card` connector."""
    travelhub_card: NotRequired[Nullable[TravelhubOptionsTypedDict]]
    r"""Custom options to be passed to the `travelhub-card` connector."""
    trustly_trustly: NotRequired[Nullable[TrustlyOptionsTypedDict]]
    r"""Custom options to be passed to the `trustly-trustly` connector."""
    wpay_everydaypay: NotRequired[Nullable[WpayEverdaypayOptionsTypedDict]]
    r"""Custom options to be passed to the `wpay-everydaypay` connector."""
    wpay_payto: NotRequired[Nullable[WpayPaytoOptionsTypedDict]]
    r"""Custom options to be passed to the `wpay-payto` connector."""


class TransactionConnectionOptions(BaseModel):
    account_updater: Annotated[
        OptionalNullable[AccountUpdaterOptions], pydantic.Field(alias="account-updater")
    ] = UNSET
    r"""Custom options to be passed to the `account-updater` connector, allowing for simulating different account updater responses."""

    adyen_afterpay: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-afterpay")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-afterpay` connector."""

    adyen_alipay: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-alipay")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-alipay` connector."""

    adyen_card: Annotated[
        OptionalNullable[AdyenCardOptions], pydantic.Field(alias="adyen-card")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-card` connector."""

    adyen_cashapp: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-cashapp")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-cashapp` connector."""

    adyen_giropay: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-giropay")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-giropay` connector."""

    adyen_ideal: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-ideal")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-ideal` connector."""

    adyen_sepa: Annotated[
        OptionalNullable[AdyenSepaOptions], pydantic.Field(alias="adyen-sepa")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-sepa` connector."""

    adyen_sofort: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-sofort")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-sofort` connector."""

    adyen_vipps: Annotated[
        OptionalNullable[AdyenOptions], pydantic.Field(alias="adyen-vipps")
    ] = UNSET
    r"""Custom options to be passed to the `adyen-vipps` connector."""

    affirm_affirm: Annotated[
        OptionalNullable[AffirmOptions], pydantic.Field(alias="affirm-affirm")
    ] = UNSET
    r"""Custom options to be passed to the `affirm-affirm` connector."""

    braintree_card: Annotated[
        OptionalNullable[BraintreeOptions], pydantic.Field(alias="braintree-card")
    ] = UNSET
    r"""Custom options to be passed to the `braintree-card` connector."""

    cybersource_anti_fraud: Annotated[
        OptionalNullable[CybersourceAntiFraudOptions],
        pydantic.Field(alias="cybersource-anti-fraud"),
    ] = UNSET
    r"""Custom options to be passed to the `cybersource-anti-fraud` connector."""

    cybersource_card: Annotated[
        OptionalNullable[CybersourceOptions], pydantic.Field(alias="cybersource-card")
    ] = UNSET
    r"""Custom options to be passed to the `cybersource-card` connector."""

    cybersource_ideal: Annotated[
        OptionalNullable[CybersourceOptions], pydantic.Field(alias="cybersource-ideal")
    ] = UNSET
    r"""Custom options to be passed to the `cybersource-ideal` connector."""

    cybersource_kcp: Annotated[
        OptionalNullable[CybersourceOptions], pydantic.Field(alias="cybersource-kcp")
    ] = UNSET
    r"""Custom options to be passed to the `cybersource-kcp` connector."""

    dlocal_nequi: Annotated[
        OptionalNullable[DlocalOptions], pydantic.Field(alias="dlocal-nequi")
    ] = UNSET
    r"""Custom options to be passed to the `dlocal-nequi` connector."""

    dlocal_upi: Annotated[
        OptionalNullable[DlocalUPIOptions], pydantic.Field(alias="dlocal-upi")
    ] = UNSET
    r"""Custom options to be passed to the `dlocal-upi` connector."""

    fiserv_card: Annotated[
        OptionalNullable[FiservOptions], pydantic.Field(alias="fiserv-card")
    ] = UNSET
    r"""Custom options to be passed to the `fiserv-card` connector."""

    forter_anti_fraud: Annotated[
        OptionalNullable[ForterAntiFraudOptions],
        pydantic.Field(alias="forter-anti-fraud"),
    ] = UNSET
    r"""Custom options to be passed to the `forter-anti-fraud` connector."""

    gem_gem: Annotated[
        OptionalNullable[LatitudeOptions], pydantic.Field(alias="gem-gem")
    ] = UNSET
    r"""Custom options to be passed to the `gem-gem` connector."""

    gem_gemds: Annotated[
        OptionalNullable[LatitudeOptions], pydantic.Field(alias="gem-gemds")
    ] = UNSET
    r"""Custom options to be passed to the `gem-gemds` connector."""

    givingblock_givingblock: Annotated[
        OptionalNullable[GivingBlockOptions],
        pydantic.Field(alias="givingblock-givingblock"),
    ] = UNSET
    r"""Custom options to be passed to the `givingblock-givingblock` connector."""

    latitude_latitude: Annotated[
        OptionalNullable[LatitudeOptions], pydantic.Field(alias="latitude-latitude")
    ] = UNSET
    r"""Custom options to be passed to the `latitude-latitude` connector."""

    latitude_latitudeds: Annotated[
        OptionalNullable[LatitudeOptions], pydantic.Field(alias="latitude-latitudeds")
    ] = UNSET
    r"""Custom options to be passed to the `latitude-latitudeds` connector."""

    mattilda_tapi: Annotated[
        OptionalNullable[MattildaTapiOptions], pydantic.Field(alias="mattilda-tapi")
    ] = UNSET
    r"""Custom options to be passed to the `mattilda-tapi` connector."""

    mattilda_tapifintechs: Annotated[
        OptionalNullable[MattildaTapiOptions],
        pydantic.Field(alias="mattilda-tapifintechs"),
    ] = UNSET
    r"""Custom options to be passed to the `mattilda-tapifintechs` connector."""

    mock_card: Annotated[
        OptionalNullable[MockCardOptions], pydantic.Field(alias="mock-card")
    ] = UNSET
    r"""Custom options to be passed to the `mock-card` connector."""

    nuvei_card: Annotated[
        OptionalNullable[NuveiOptions], pydantic.Field(alias="nuvei-card")
    ] = UNSET
    r"""Custom options to be passed to the `nuvei-card` connector."""

    nuvei_pse: Annotated[
        OptionalNullable[NuveiPSEOptions], pydantic.Field(alias="nuvei-pse")
    ] = UNSET
    r"""Custom options to be passed to the `nuvei-pse` connector."""

    oxxo_oxxo: Annotated[
        OptionalNullable[OxxoOptions], pydantic.Field(alias="oxxo-oxxo")
    ] = UNSET
    r"""Custom options to be passed to the `oxxo-oxxo` connector."""

    paypal_paypal: Annotated[
        OptionalNullable[PaypalOptions], pydantic.Field(alias="paypal-paypal")
    ] = UNSET
    r"""Custom options to be passed to the `paypal-paypal` connector."""

    paypal_paypalpaylater: Annotated[
        OptionalNullable[PaypalOptions], pydantic.Field(alias="paypal-paypalpaylater")
    ] = UNSET
    r"""Custom options to be passed to the `paypal-paypalpaylater` connector."""

    powertranz_card: Annotated[
        OptionalNullable[PowertranzOptions], pydantic.Field(alias="powertranz-card")
    ] = UNSET
    r"""Custom options to be passed to the `powertranz-card` connector."""

    stripe_card: Annotated[
        OptionalNullable[StripeOptions], pydantic.Field(alias="stripe-card")
    ] = UNSET
    r"""Custom options to be passed to the `stripe-card` connector."""

    travelhub_card: Annotated[
        OptionalNullable[TravelhubOptions], pydantic.Field(alias="travelhub-card")
    ] = UNSET
    r"""Custom options to be passed to the `travelhub-card` connector."""

    trustly_trustly: Annotated[
        OptionalNullable[TrustlyOptions], pydantic.Field(alias="trustly-trustly")
    ] = UNSET
    r"""Custom options to be passed to the `trustly-trustly` connector."""

    wpay_everydaypay: Annotated[
        OptionalNullable[WpayEverdaypayOptions],
        pydantic.Field(alias="wpay-everydaypay"),
    ] = UNSET
    r"""Custom options to be passed to the `wpay-everydaypay` connector."""

    wpay_payto: Annotated[
        OptionalNullable[WpayPaytoOptions], pydantic.Field(alias="wpay-payto")
    ] = UNSET
    r"""Custom options to be passed to the `wpay-payto` connector."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = [
            "account-updater",
            "adyen-afterpay",
            "adyen-alipay",
            "adyen-card",
            "adyen-cashapp",
            "adyen-giropay",
            "adyen-ideal",
            "adyen-sepa",
            "adyen-sofort",
            "adyen-vipps",
            "affirm-affirm",
            "braintree-card",
            "cybersource-anti-fraud",
            "cybersource-card",
            "cybersource-ideal",
            "cybersource-kcp",
            "dlocal-nequi",
            "dlocal-upi",
            "fiserv-card",
            "forter-anti-fraud",
            "gem-gem",
            "gem-gemds",
            "givingblock-givingblock",
            "latitude-latitude",
            "latitude-latitudeds",
            "mattilda-tapi",
            "mattilda-tapifintechs",
            "mock-card",
            "nuvei-card",
            "nuvei-pse",
            "oxxo-oxxo",
            "paypal-paypal",
            "paypal-paypalpaylater",
            "powertranz-card",
            "stripe-card",
            "travelhub-card",
            "trustly-trustly",
            "wpay-everydaypay",
            "wpay-payto",
        ]
        nullable_fields = [
            "account-updater",
            "adyen-afterpay",
            "adyen-alipay",
            "adyen-card",
            "adyen-cashapp",
            "adyen-giropay",
            "adyen-ideal",
            "adyen-sepa",
            "adyen-sofort",
            "adyen-vipps",
            "affirm-affirm",
            "braintree-card",
            "cybersource-anti-fraud",
            "cybersource-card",
            "cybersource-ideal",
            "cybersource-kcp",
            "dlocal-nequi",
            "dlocal-upi",
            "fiserv-card",
            "forter-anti-fraud",
            "gem-gem",
            "gem-gemds",
            "givingblock-givingblock",
            "latitude-latitude",
            "latitude-latitudeds",
            "mattilda-tapi",
            "mattilda-tapifintechs",
            "mock-card",
            "nuvei-card",
            "nuvei-pse",
            "oxxo-oxxo",
            "paypal-paypal",
            "paypal-paypalpaylater",
            "powertranz-card",
            "stripe-card",
            "travelhub-card",
            "trustly-trustly",
            "wpay-everydaypay",
            "wpay-payto",
        ]
        null_default_fields = []

        serialized = handler(self)

        m = {}

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

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m
