"""visaacceptancemergedspec.

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

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


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

    Attributes:
        alert_preference (str): Applicable only for SI. Required in case the
            authentication is initiated for SI registration. Valid Values: - `SMS` -
            `EMAIL` - `BOTH`
        first_installment_date (str): Date of the first installment payment. Format:
            YYMMDD. When you do not include this field, Visa Acceptance sends a
            string of six zeros (000000) to the processor.  This field is supported
            only for Crediario installment payments in Brazil on Visa Acceptance
            through VisaNet.  The value for this field corresponds to the following
            data in the TC 33 capture file: - Record: CP01 TCR9 - Position: 42-47 -
            Field: Date of First Installment
        identifier (str): Standing Instruction/Installment identifier.
        last_installment_date (str): End date of the SI transactions. Cannot be later
            than card expiry date. Ideally this can be set to expiry date. Required
            in case the authentication is initiated for SI registration.
        max_amount (str): Maximum Amount for which SI can be initiated. Required in
            case the authentication is initiated for SI registration.
        min_amount (str): Minimum Amount for which SI can be initiated. Required in
            case the authentication is initiated for SI registration.
        payment_type (str): Payment plan for the installments. This field is
            supported only for installment payments on Visa Platform Connect, RuPay
            and SPG-KSA seamless flow.  Possible values for a standing-instruction
            (SI) merchant-initiated transaction (MIT) with Diners Club or Mastercard
            in India or with an India-issued card: - 1: SI with a fixed amount. - 2:
            SI with a maximum amount. - 3: Other kind of SI.  Possible values for a
            type of Installment transaction for on-soil transaction in Kingdom of
            Saudi Arabia - 1: Registration or first transaction. - 2: Subsequent
            transaction.  Possible values for other kinds of installment payments: -
            0 (default): Regular installment. This value is not allowed for airline
            transactions. - 1: Installment payment with down payment. - 2:
            Installment payment without down payment. This value is supported only
            for airline transactions. - 3: Installment payment; down payment and
            boarding fee will follow. This value is supported only for airline
            transactions. - 4: Down payment only; regular installment payment will
            follow. - 5: Boarding fee only. This value is supported only for airline
            transactions. - 6: SI de-registration on RuPay for the payer
            authentication seamless flow.
        preferred_day (str): Preferred date for initiating the SI transaction every
            month. This field need not be sent in case the SI has to be initiated as
            and when required, e.g., topping up the wallet, etc.
        sequence (int): Installment number when making payments in installments. Used
            along with `totalCount` to track which payment is being processed.  For
            example, the second of 5 payments would be passed to Visa Acceptance as
            `sequence` = 2 and `totalCount` = 5.  #### Chase Paymentech Solutions and
            FDC Compass This field is optional because this value is required in the
            merchant descriptors.  #### Visa Acceptance through VisaNet When you do
            not include this field in a request for a Crediario installment payment,
            Visa Acceptance sends a value of 0 to the processor.  For Crediario
            installment payments, the value for this field corresponds to the
            following data in the TC 33 capture file*: - Record: CP01 TCR9 -
            Position: 38-40 - Field: Installment Payment Number  * 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.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "alert_preference": "alertPreference",
        "first_installment_date": "firstInstallmentDate",
        "identifier": "identifier",
        "last_installment_date": "lastInstallmentDate",
        "max_amount": "maxAmount",
        "min_amount": "minAmount",
        "payment_type": "paymentType",
        "preferred_day": "preferredDay",
        "sequence": "sequence",
    }

    _optionals = [
        "alert_preference",
        "first_installment_date",
        "identifier",
        "last_installment_date",
        "max_amount",
        "min_amount",
        "payment_type",
        "preferred_day",
        "sequence",
    ]

    def __init__(
        self,
        alert_preference=APIHelper.SKIP,
        first_installment_date=APIHelper.SKIP,
        identifier=APIHelper.SKIP,
        last_installment_date=APIHelper.SKIP,
        max_amount=APIHelper.SKIP,
        min_amount=APIHelper.SKIP,
        payment_type=APIHelper.SKIP,
        preferred_day=APIHelper.SKIP,
        sequence=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a InstallmentInformation4 instance."""
        # Initialize members of the class
        if alert_preference is not APIHelper.SKIP:
            self.alert_preference = alert_preference
        if first_installment_date is not APIHelper.SKIP:
            self.first_installment_date = first_installment_date
        if identifier is not APIHelper.SKIP:
            self.identifier = identifier
        if last_installment_date is not APIHelper.SKIP:
            self.last_installment_date = last_installment_date
        if max_amount is not APIHelper.SKIP:
            self.max_amount = max_amount
        if min_amount is not APIHelper.SKIP:
            self.min_amount = min_amount
        if payment_type is not APIHelper.SKIP:
            self.payment_type = payment_type
        if preferred_day is not APIHelper.SKIP:
            self.preferred_day = preferred_day
        if sequence is not APIHelper.SKIP:
            self.sequence = sequence

        # 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
        alert_preference =\
            dictionary.get("alertPreference")\
            if dictionary.get("alertPreference")\
                else APIHelper.SKIP
        first_installment_date =\
            dictionary.get("firstInstallmentDate")\
            if dictionary.get("firstInstallmentDate")\
                else APIHelper.SKIP
        identifier =\
            dictionary.get("identifier")\
            if dictionary.get("identifier")\
                else APIHelper.SKIP
        last_installment_date =\
            dictionary.get("lastInstallmentDate")\
            if dictionary.get("lastInstallmentDate")\
                else APIHelper.SKIP
        max_amount =\
            dictionary.get("maxAmount")\
            if dictionary.get("maxAmount")\
                else APIHelper.SKIP
        min_amount =\
            dictionary.get("minAmount")\
            if dictionary.get("minAmount")\
                else APIHelper.SKIP
        payment_type =\
            dictionary.get("paymentType")\
            if dictionary.get("paymentType")\
                else APIHelper.SKIP
        preferred_day =\
            dictionary.get("preferredDay")\
            if dictionary.get("preferredDay")\
                else APIHelper.SKIP
        sequence =\
            dictionary.get("sequence")\
            if dictionary.get("sequence")\
                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(alert_preference,
                   first_installment_date,
                   identifier,
                   last_installment_date,
                   max_amount,
                   min_amount,
                   payment_type,
                   preferred_day,
                   sequence,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _alert_preference=(
            self.alert_preference
            if hasattr(self, "alert_preference")
            else None
        )
        _first_installment_date=(
            self.first_installment_date
            if hasattr(self, "first_installment_date")
            else None
        )
        _identifier=(
            self.identifier
            if hasattr(self, "identifier")
            else None
        )
        _last_installment_date=(
            self.last_installment_date
            if hasattr(self, "last_installment_date")
            else None
        )
        _max_amount=(
            self.max_amount
            if hasattr(self, "max_amount")
            else None
        )
        _min_amount=(
            self.min_amount
            if hasattr(self, "min_amount")
            else None
        )
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _preferred_day=(
            self.preferred_day
            if hasattr(self, "preferred_day")
            else None
        )
        _sequence=(
            self.sequence
            if hasattr(self, "sequence")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"alert_preference={_alert_preference!r}, "
            f"first_installment_date={_first_installment_date!r}, "
            f"identifier={_identifier!r}, "
            f"last_installment_date={_last_installment_date!r}, "
            f"max_amount={_max_amount!r}, "
            f"min_amount={_min_amount!r}, "
            f"payment_type={_payment_type!r}, "
            f"preferred_day={_preferred_day!r}, "
            f"sequence={_sequence!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _alert_preference=(
            self.alert_preference
            if hasattr(self, "alert_preference")
            else None
        )
        _first_installment_date=(
            self.first_installment_date
            if hasattr(self, "first_installment_date")
            else None
        )
        _identifier=(
            self.identifier
            if hasattr(self, "identifier")
            else None
        )
        _last_installment_date=(
            self.last_installment_date
            if hasattr(self, "last_installment_date")
            else None
        )
        _max_amount=(
            self.max_amount
            if hasattr(self, "max_amount")
            else None
        )
        _min_amount=(
            self.min_amount
            if hasattr(self, "min_amount")
            else None
        )
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _preferred_day=(
            self.preferred_day
            if hasattr(self, "preferred_day")
            else None
        )
        _sequence=(
            self.sequence
            if hasattr(self, "sequence")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"alert_preference={_alert_preference!s}, "
            f"first_installment_date={_first_installment_date!s}, "
            f"identifier={_identifier!s}, "
            f"last_installment_date={_last_installment_date!s}, "
            f"max_amount={_max_amount!s}, "
            f"min_amount={_min_amount!s}, "
            f"payment_type={_payment_type!s}, "
            f"preferred_day={_preferred_day!s}, "
            f"sequence={_sequence!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
