"""visaacceptancemergedspec.

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

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


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

    Attributes:
        plan_type (str): #### American Express Direct, Cielo, and Visa Acceptance
            Latin American Processing Flag that indicates the type of funding for the
            installment plan associated with the payment.  Possible values: - `1`:
            Merchant-funded installment plan - `2`: Issuer-funded installment plan If
            you do not include this field in the request, Visa Acceptance uses the
            value in your Visa Acceptance account.  To change the value in your Visa
            Acceptance account, contact Visa Acceptance Customer Service.  #### Visa
            Acceptance through VisaNet and American Express Defined code that
            indicates the type of installment plan for this transaction.  Contact
            American Express for: - Information about the kinds of installment plans
            that American Express provides - Values for this field  For installment
            payments with American Express in Brazil, the value for this field
            corresponds to the following data in the TC 33 capture file*: - Record:
            CP07 TCR3 - Position: 5-6 - Field: Plan Type  * The TC 33 Capture file
            contains information about the purchases and refunds that a merchant
            submits to Visa Acceptance. Visa Acceptance through VisaNet creates the
            TC 33 Capture file at the end of the day and sends it to the merchant’s
            acquirer, who uses this information to facilitate end-of-day clearing
            processing with payment card companies.  #### Visa Acceptance through
            VisaNet with Visa or Mastercard Flag indicating the type of funding for
            the installment plan associated with the payment. Possible values: - 1 or
            01: Merchant-funded installment plan - 2 or 02: Issuer-funded installment
            plan - 43: Crediario installment plan—only with Visa in Brazil  For
            installment payments with Visa in Brazil, the value for this field
            corresponds to the following data in the TC 33 capture file5: - Record:
            CP07 TCR1 - Position: 5-6 - Field: Installment Type  For all other kinds
            of installment payments, the value for this field corresponds to the
            following data in the TC 33 capture file5: - Record: CP01 TCR5 -
            Position: 39-40 - Field: Installment Plan Type (Issuer or Merchant)
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "plan_type": "planType",
    }

    _optionals = [
        "plan_type",
    ]

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

        # 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
        plan_type =\
            dictionary.get("planType")\
            if dictionary.get("planType")\
                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(plan_type,
                   additional_properties)

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

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