"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper
from cellpointapi.models.apple_pay_config import (
    ApplePayConfig,
)
from cellpointapi.models.card_config import (
    CardConfig,
)
from cellpointapi.models.paypal_config import (
    PaypalConfig,
)
from cellpointapi.models.uplift_config import (
    UpliftConfig,
)
from cellpointapi.models.voucher_config import (
    VoucherConfig,
)


class PaymentMethodsForOrderGet200Response(object):
    """Implementation of the 'Payment-Methods.ForOrder.GET.200.Response' model.

    Available payment methods for the order.

    Attributes:
        available_payment_methods (List[PaymentMethod]): The model property of type
            List[PaymentMethod].
        card_method_configuration (CardConfig): Credit/Debit Card Payment Method that
            involves a card number (PAN), expiry, and security code.
        apple_pay_method_configuration (ApplePayConfig): Configuration for Apple Pay.
        paypal_method_configuration (PaypalConfig): Configuration for PayPal.
        uplift_method_configuration (UpliftConfig): Configuration for Uplift.
        voucher_method_configuration (VoucherConfig): Configuration for Voucher.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "available_payment_methods": "availablePaymentMethods",
        "card_method_configuration": "cardMethodConfiguration",
        "apple_pay_method_configuration": "applePayMethodConfiguration",
        "paypal_method_configuration": "paypalMethodConfiguration",
        "uplift_method_configuration": "upliftMethodConfiguration",
        "voucher_method_configuration": "voucherMethodConfiguration",
    }

    _optionals = [
        "card_method_configuration",
        "apple_pay_method_configuration",
        "paypal_method_configuration",
        "uplift_method_configuration",
        "voucher_method_configuration",
    ]

    def __init__(
        self,
        available_payment_methods=None,
        card_method_configuration=APIHelper.SKIP,
        apple_pay_method_configuration=APIHelper.SKIP,
        paypal_method_configuration=APIHelper.SKIP,
        uplift_method_configuration=APIHelper.SKIP,
        voucher_method_configuration=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PaymentMethodsForOrderGet200Response instance."""
        # Initialize members of the class
        self.available_payment_methods = available_payment_methods
        if card_method_configuration is not APIHelper.SKIP:
            self.card_method_configuration = card_method_configuration
        if apple_pay_method_configuration is not APIHelper.SKIP:
            self.apple_pay_method_configuration = apple_pay_method_configuration
        if paypal_method_configuration is not APIHelper.SKIP:
            self.paypal_method_configuration = paypal_method_configuration
        if uplift_method_configuration is not APIHelper.SKIP:
            self.uplift_method_configuration = uplift_method_configuration
        if voucher_method_configuration is not APIHelper.SKIP:
            self.voucher_method_configuration = voucher_method_configuration

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        available_payment_methods =\
            dictionary.get("availablePaymentMethods")\
            if dictionary.get("availablePaymentMethods")\
                else None
        card_method_configuration =\
            CardConfig.from_dictionary(
                dictionary.get("cardMethodConfiguration"))\
                if "cardMethodConfiguration" in dictionary.keys()\
                else APIHelper.SKIP
        apple_pay_method_configuration =\
            ApplePayConfig.from_dictionary(
                dictionary.get("applePayMethodConfiguration"))\
                if "applePayMethodConfiguration" in dictionary.keys()\
                else APIHelper.SKIP
        paypal_method_configuration =\
            PaypalConfig.from_dictionary(
                dictionary.get("paypalMethodConfiguration"))\
                if "paypalMethodConfiguration" in dictionary.keys()\
                else APIHelper.SKIP
        uplift_method_configuration =\
            UpliftConfig.from_dictionary(
                dictionary.get("upliftMethodConfiguration"))\
                if "upliftMethodConfiguration" in dictionary.keys()\
                else APIHelper.SKIP
        voucher_method_configuration =\
            VoucherConfig.from_dictionary(
                dictionary.get("voucherMethodConfiguration"))\
                if "voucherMethodConfiguration" in dictionary.keys()\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(available_payment_methods,
                   card_method_configuration,
                   apple_pay_method_configuration,
                   paypal_method_configuration,
                   uplift_method_configuration,
                   voucher_method_configuration,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _available_payment_methods=self.available_payment_methods
        _card_method_configuration=(
            self.card_method_configuration
            if hasattr(self, "card_method_configuration")
            else None
        )
        _apple_pay_method_configuration=(
            self.apple_pay_method_configuration
            if hasattr(self, "apple_pay_method_configuration")
            else None
        )
        _paypal_method_configuration=(
            self.paypal_method_configuration
            if hasattr(self, "paypal_method_configuration")
            else None
        )
        _uplift_method_configuration=(
            self.uplift_method_configuration
            if hasattr(self, "uplift_method_configuration")
            else None
        )
        _voucher_method_configuration=(
            self.voucher_method_configuration
            if hasattr(self, "voucher_method_configuration")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"available_payment_methods={_available_payment_methods!r}, "
            f"card_method_configuration={_card_method_configuration!r}, "
            f"apple_pay_method_configuration={_apple_pay_method_configuration!r}, "
            f"paypal_method_configuration={_paypal_method_configuration!r}, "
            f"uplift_method_configuration={_uplift_method_configuration!r}, "
            f"voucher_method_configuration={_voucher_method_configuration!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _available_payment_methods=self.available_payment_methods
        _card_method_configuration=(
            self.card_method_configuration
            if hasattr(self, "card_method_configuration")
            else None
        )
        _apple_pay_method_configuration=(
            self.apple_pay_method_configuration
            if hasattr(self, "apple_pay_method_configuration")
            else None
        )
        _paypal_method_configuration=(
            self.paypal_method_configuration
            if hasattr(self, "paypal_method_configuration")
            else None
        )
        _uplift_method_configuration=(
            self.uplift_method_configuration
            if hasattr(self, "uplift_method_configuration")
            else None
        )
        _voucher_method_configuration=(
            self.voucher_method_configuration
            if hasattr(self, "voucher_method_configuration")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"available_payment_methods={_available_payment_methods!s}, "
            f"card_method_configuration={_card_method_configuration!s}, "
            f"apple_pay_method_configuration={_apple_pay_method_configuration!s}, "
            f"paypal_method_configuration={_paypal_method_configuration!s}, "
            f"uplift_method_configuration={_uplift_method_configuration!s}, "
            f"voucher_method_configuration={_voucher_method_configuration!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
