
"""
cellpointapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""

# ruff: noqa: E501
from __future__ import annotations

from typing import (
    Callable,
    ClassVar,
)

from apimatic_core.types.union_types.leaf_type import (
    LeafType,
)
from apimatic_core.types.union_types.one_of import (
    OneOf,
)
from apimatic_core.types.union_types.union_type_context import (
    UnionTypeContext as Context,
)

from cellpointapi.models.activity import Activity
from cellpointapi.models.airline_ancillary import (
    AirlineAncillary,
)
from cellpointapi.models.airline_fare import (
    AirlineFare,
)
from cellpointapi.models.apple_pay_payment_instrument import (
    ApplePayPaymentInstrument,
)
from cellpointapi.models.auto_rental import (
    AutoRental,
)
from cellpointapi.models.bundle import Bundle
from cellpointapi.models.bundled_activity import (
    BundledActivity,
)
from cellpointapi.models.bundled_airline_ancillary import (
    BundledAirlineAncillary,
)
from cellpointapi.models.bundled_airline_fare import (
    BundledAirlineFare,
)
from cellpointapi.models.bundled_auto_rental import (
    BundledAutoRental,
)
from cellpointapi.models.bundled_discount import (
    BundledDiscount,
)
from cellpointapi.models.bundled_lodging_reservation import (
    BundledLodgingReservation,
)
from cellpointapi.models.bundled_product import (
    BundledProduct,
)
from cellpointapi.models.card_payment_instrument import (
    CardPaymentInstrument,
)
from cellpointapi.models.discount import Discount
from cellpointapi.models.external_transaction import (
    ExternalTransaction,
)
from cellpointapi.models.fulfilled_activity import (
    FulfilledActivity,
)
from cellpointapi.models.fulfilled_airline_ancillary import (
    FulfilledAirlineAncillary,
)
from cellpointapi.models.fulfilled_airline_fare import (
    FulfilledAirlineFare,
)
from cellpointapi.models.fulfilled_auto_rental import (
    FulfilledAutoRental,
)
from cellpointapi.models.fulfilled_bundle import (
    FulfilledBundle,
)
from cellpointapi.models.fulfilled_discount import (
    FulfilledDiscount,
)
from cellpointapi.models.fulfilled_lodging_reservation import (
    FulfilledLodgingReservation,
)
from cellpointapi.models.fulfilled_product import (
    FulfilledProduct,
)
from cellpointapi.models.lodging_reservation import (
    LodgingReservation,
)
from cellpointapi.models.order_payment_summary import (
    OrderPaymentSummary,
)
from cellpointapi.models.pay_pal_action import (
    PayPalAction,
)
from cellpointapi.models.pay_pal_payment_instrument import (
    PayPalPaymentInstrument,
)
from cellpointapi.models.payment_transaction import (
    PaymentTransaction,
)
from cellpointapi.models.product import Product
from cellpointapi.models.redirect_action import (
    RedirectAction,
)
from cellpointapi.models.refund_transaction import (
    RefundTransaction,
)
from cellpointapi.models.uplift_payment_instrument import (
    UpliftPaymentInstrument,
)
from cellpointapi.models.voucher_payment_instrument import (
    VoucherPaymentInstrument,
)
from cellpointapi.models.wallet_payment_instrument import (
    WalletPaymentInstrument,
)


class UnionTypeLookUp:
    """
    Provides lookup and factory methods for predefined union type templates.
    This class stores a mapping of template names to callables that construct
    union type instances. These templates are used to describe compatible
    data shapes by combining primitive or model-based types into a single
    resolved representation at runtime.

    Attributes:
        _templates (dict): A mapping of template names to factory callables
        that create configured union types.

    """

    _templates: ClassVar[dict[str, Callable]] = {
        "BundledItem": lambda: OneOf(
            [
                LeafType(BundledProduct,
                         Context.create(
                             discriminator_value="PRODUCT",
                             discriminator="type",
                         )),
                LeafType(BundledActivity,
                         Context.create(
                             discriminator_value="ACTIVITY",
                             discriminator="type",
                         )),
                LeafType(BundledAirlineAncillary,
                         Context.create(
                             discriminator_value="AIRLINE_ANCILLARY",
                             discriminator="type",
                         )),
                LeafType(BundledAirlineFare,
                         Context.create(
                             discriminator_value="AIRLINE_FARE",
                             discriminator="type",
                         )),
                LeafType(BundledAutoRental,
                         Context.create(
                             discriminator_value="AUTO_RENTAL",
                             discriminator="type",
                         )),
                LeafType(BundledDiscount,
                         Context.create(
                             discriminator_value="DISCOUNT",
                             discriminator="type",
                         )),
                LeafType(BundledLodgingReservation,
                         Context.create(
                             discriminator_value="LODGING_RESERVATION",
                             discriminator="type",
                         )),
            ],
            Context.create(
               is_array=True,
            ),
        ),
        "LineItem": lambda: OneOf(
            [
                LeafType(Product,
                         Context.create(
                             discriminator_value="PRODUCT",
                             discriminator="type",
                         )),
                LeafType(Activity,
                         Context.create(
                             discriminator_value="ACTIVITY",
                             discriminator="type",
                         )),
                LeafType(AirlineFare,
                         Context.create(
                             discriminator_value="AIRLINE_FARE",
                             discriminator="type",
                         )),
                LeafType(AirlineAncillary,
                         Context.create(
                             discriminator_value="AIRLINE_ANCILLARY",
                             discriminator="type",
                         )),
                LeafType(AutoRental,
                         Context.create(
                             discriminator_value="AUTO_RENTAL",
                             discriminator="type",
                         )),
                LeafType(Bundle,
                         Context.create(
                             discriminator_value="BUNDLE",
                             discriminator="type",
                         )),
                LeafType(Discount,
                         Context.create(
                             discriminator_value="DISCOUNT",
                             discriminator="type",
                         )),
                LeafType(LodgingReservation,
                         Context.create(
                             discriminator_value="LODGING_RESERVATION",
                             discriminator="type",
                         )),
            ],
            Context.create(
               is_array=True,
            ),
        ),
        "PaymentInstrument": lambda: OneOf(
            [
                LeafType(CardPaymentInstrument,
                         Context.create(
                             discriminator_value="CARD",
                             discriminator="method",
                         )),
                LeafType(ApplePayPaymentInstrument,
                         Context.create(
                             discriminator_value="APPLE_PAY",
                             discriminator="method",
                         )),
                LeafType(PayPalPaymentInstrument,
                         Context.create(
                             discriminator_value="PAYPAL",
                             discriminator="method",
                         )),
                LeafType(VoucherPaymentInstrument,
                         Context.create(
                             discriminator_value="VOUCHER",
                             discriminator="method",
                         )),
                LeafType(WalletPaymentInstrument,
                         Context.create(
                             discriminator_value="WALLET",
                             discriminator="method",
                         )),
                LeafType(UpliftPaymentInstrument,
                         Context.create(
                             discriminator_value="UPLIFT",
                             discriminator="method",
                         )),
            ],
        ),
        "Action": lambda: OneOf(
            [
                LeafType(PayPalAction,
                         Context.create(
                             discriminator_value="PAYPAL",
                             discriminator="actionType",
                         )),
                LeafType(RedirectAction,
                         Context.create(
                             discriminator_value="REDIRECT",
                             discriminator="actionType",
                         )),
            ],
            Context.create(
               is_optional=True,
            ),
        ),
        "Transaction": lambda: OneOf(
            [
                LeafType(PaymentTransaction,
                         Context.create(
                             discriminator_value="PAYMENT",
                             discriminator="type",
                         )),
                LeafType(RefundTransaction,
                         Context.create(
                             discriminator_value="REFUND",
                             discriminator="type",
                         )),
                LeafType(ExternalTransaction,
                         Context.create(
                             discriminator_value="EXTERNAL",
                             discriminator="type",
                         )),
            ],
            Context.create(
               is_array=True,
               is_optional=True,
            ),
        ),
        "AuthorizationPaymentInstrument": lambda: OneOf(
            [
                LeafType(CardPaymentInstrument,
                         Context.create(
                             discriminator_value="CARD",
                             discriminator="method",
                         )),
                LeafType(ApplePayPaymentInstrument,
                         Context.create(
                             discriminator_value="APPLE_PAY",
                             discriminator="method",
                         )),
                LeafType(PayPalPaymentInstrument,
                         Context.create(
                             discriminator_value="PAYPAL",
                             discriminator="method",
                         )),
                LeafType(VoucherPaymentInstrument,
                         Context.create(
                             discriminator_value="VOUCHER",
                             discriminator="method",
                         )),
                LeafType(WalletPaymentInstrument,
                         Context.create(
                             discriminator_value="WALLET",
                             discriminator="method",
                         )),
                LeafType(UpliftPaymentInstrument,
                         Context.create(
                             discriminator_value="UPLIFT",
                             discriminator="method",
                         )),
            ],
        ),
        "Transaction2": lambda: OneOf(
            [
                LeafType(PaymentTransaction,
                         Context.create(
                             discriminator_value="PAYMENT",
                             discriminator="type",
                         )),
                LeafType(RefundTransaction,
                         Context.create(
                             discriminator_value="REFUND",
                             discriminator="type",
                         )),
                LeafType(ExternalTransaction,
                         Context.create(
                             discriminator_value="EXTERNAL",
                             discriminator="type",
                         )),
            ],
            Context.create(
               is_array=True,
            ),
        ),
        "FulfilledLineItem": lambda: OneOf(
            [
                LeafType(FulfilledActivity,
                         Context.create(
                             discriminator_value="ACTIVITY",
                             discriminator="type",
                         )),
                LeafType(FulfilledAirlineAncillary,
                         Context.create(
                             discriminator_value="AIRLINE_ANCILLARY",
                             discriminator="type",
                         )),
                LeafType(FulfilledAirlineFare,
                         Context.create(
                             discriminator_value="AIRLINE_FARE",
                             discriminator="type",
                         )),
                LeafType(FulfilledAutoRental,
                         Context.create(
                             discriminator_value="AUTO_RENTAL",
                             discriminator="type",
                         )),
                LeafType(FulfilledBundle,
                         Context.create(
                             discriminator_value="BUNDLE",
                             discriminator="type",
                         )),
                LeafType(FulfilledDiscount,
                         Context.create(
                             discriminator_value="DISCOUNT",
                             discriminator="type",
                         )),
                LeafType(FulfilledLodgingReservation,
                         Context.create(
                             discriminator_value="LODGING_RESERVATION",
                             discriminator="type",
                         )),
                LeafType(FulfilledProduct,
                         Context.create(
                             discriminator_value="PRODUCT",
                             discriminator="type",
                         )),
            ],
            Context.create(
               is_array=True,
               is_optional=True,
            ),
        ),
        "Callbacks": lambda: OneOf(
            [
                LeafType(OrderPaymentSummary),
            ],
        ),
    }

    @staticmethod
    def get(name):
        """
        Retrieve and construct a union type template by name.

        Args:
            name (str): The key identifying the template to resolve.

        Returns:
            Any: A new instance of the union type defined for the given name.

        Raises:
            KeyError: If no template exists for the specified name.

        """
        return UnionTypeLookUp._templates[name]()
