"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


class JapanPaymentOptions1(object):
    """Implementation of the 'JapanPaymentOptions1' model.

    Attributes:
        payment_method (str): This value is a 2-digit code indicating the payment
            method. Use Payment Method Code value that applies to the tranasction. -
            10 (One-time payment) - 21, 22, 23, 24  (Bonus(one-time)payment) - 61
            (Installment payment) - 31, 32, 33, 34  (Integrated (Bonus +
            Installment)payment) - 80 (Revolving payment)
        installments (str): Number of Installments.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "payment_method": "paymentMethod",
        "installments": "installments",
    }

    _optionals = [
        "payment_method",
        "installments",
    ]

    def __init__(
        self,
        payment_method=APIHelper.SKIP,
        installments=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a JapanPaymentOptions1 instance."""
        # Initialize members of the class
        if payment_method is not APIHelper.SKIP:
            self.payment_method = payment_method
        if installments is not APIHelper.SKIP:
            self.installments = installments

        # 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
        payment_method =\
            dictionary.get("paymentMethod")\
            if dictionary.get("paymentMethod")\
                else APIHelper.SKIP
        installments =\
            dictionary.get("installments")\
            if dictionary.get("installments")\
                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(payment_method,
                   installments,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _payment_method=(
            self.payment_method
            if hasattr(self, "payment_method")
            else None
        )
        _installments=(
            self.installments
            if hasattr(self, "installments")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"payment_method={_payment_method!r}, "
            f"installments={_installments!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _payment_method=(
            self.payment_method
            if hasattr(self, "payment_method")
            else None
        )
        _installments=(
            self.installments
            if hasattr(self, "installments")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"payment_method={_payment_method!s}, "
            f"installments={_installments!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
