"""visaacceptancemergedspec.

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

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


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

    Attributes:
        end_date (str): The date after which no further recurring authorizations
            should be performed. Format: `YYYY-MM-DD` **Note** This field is required
            for recurring transactions.
        frequency (int): Integer value indicating the minimum number of days between
            recurring authorizations. A frequency of monthly is indicated by the
            value 28. Multiple of 28 days will be used to indicate months.  Example:
            6 months = 168  Example values accepted (31 days): - 31 - 031 - 0031
            **Note** This field is required for recurring transactions.
        number_of_payments (int): Total number of payments for the duration of the
            recurring subscription.
        original_purchase_date (str): Date of original purchase. Required for
            recurring transactions. Format: `YYYY-MM-DDTHH:MM:SSZ` **Note**: If this
            field is empty, the current date is used.
        sequence_number (int): This field is mandatory for Cartes Bancaires recurring
            transactions on Credit Mutuel-CIC.       This field records recurring
            sequence, e.g. 1st for initial,  2 for subsequent, 3 etc
        mtype (str): This contains the type of recurring payment. Valid Values : 1 -
            Registration/First transaction 2 - Subsequent transaction 3 -
            Modification 4 - Cancellation
        occurrence (str): This value indicates how often a recurring payment occurs.
            Valid Values : • 01 (Daily) • 02 (Twice weekly) • 03 (Weekly) • 04 (Ten
            days) • 05 (Fortnightly) • 06 (Monthly) • 07 (Every two months) • 08
            (Trimester) • 09 (Quarterly) • 10 (Twice yearly) • 11 (Annually) • 12
            (Unscheduled)
        validation_indicator (str): This tag will contain a value that indicates
            whether or not the recurring payment transaction has been validated.
            Valid values : 0- Not validated 1- Validated
        amount_type (str): Indicates recurring amount type agreed by the cardholder
            Valid Values : 1- Fixed amount recurring payment 2- Recurring payment
            with maximum amount
        maximum_amount (str): This API field will contain the maximum amount agreed
            to by the cardholder. The currency of this amount will be specified in
            Field 49—Currency Code,Transaction.
        reference_number (str): This will contain a unique reference number for the
            recurring payment transaction.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "end_date": "endDate",
        "frequency": "frequency",
        "number_of_payments": "numberOfPayments",
        "original_purchase_date": "originalPurchaseDate",
        "sequence_number": "sequenceNumber",
        "mtype": "type",
        "occurrence": "occurrence",
        "validation_indicator": "validationIndicator",
        "amount_type": "amountType",
        "maximum_amount": "maximumAmount",
        "reference_number": "referenceNumber",
    }

    _optionals = [
        "number_of_payments",
        "original_purchase_date",
        "sequence_number",
        "mtype",
        "occurrence",
        "validation_indicator",
        "amount_type",
        "maximum_amount",
        "reference_number",
    ]

    def __init__(
        self,
        end_date=None,
        frequency=None,
        number_of_payments=APIHelper.SKIP,
        original_purchase_date=APIHelper.SKIP,
        sequence_number=APIHelper.SKIP,
        mtype=APIHelper.SKIP,
        occurrence=APIHelper.SKIP,
        validation_indicator=APIHelper.SKIP,
        amount_type=APIHelper.SKIP,
        maximum_amount=APIHelper.SKIP,
        reference_number=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RecurringPaymentInformation2 instance."""
        # Initialize members of the class
        self.end_date = end_date
        self.frequency = frequency
        if number_of_payments is not APIHelper.SKIP:
            self.number_of_payments = number_of_payments
        if original_purchase_date is not APIHelper.SKIP:
            self.original_purchase_date = original_purchase_date
        if sequence_number is not APIHelper.SKIP:
            self.sequence_number = sequence_number
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if occurrence is not APIHelper.SKIP:
            self.occurrence = occurrence
        if validation_indicator is not APIHelper.SKIP:
            self.validation_indicator = validation_indicator
        if amount_type is not APIHelper.SKIP:
            self.amount_type = amount_type
        if maximum_amount is not APIHelper.SKIP:
            self.maximum_amount = maximum_amount
        if reference_number is not APIHelper.SKIP:
            self.reference_number = reference_number

        # 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
        end_date =\
            dictionary.get("endDate")\
            if dictionary.get("endDate")\
                else None
        frequency =\
            dictionary.get("frequency")\
            if dictionary.get("frequency")\
                else None
        number_of_payments =\
            dictionary.get("numberOfPayments")\
            if dictionary.get("numberOfPayments")\
                else APIHelper.SKIP
        original_purchase_date =\
            dictionary.get("originalPurchaseDate")\
            if dictionary.get("originalPurchaseDate")\
                else APIHelper.SKIP
        sequence_number =\
            dictionary.get("sequenceNumber")\
            if dictionary.get("sequenceNumber")\
                else APIHelper.SKIP
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        occurrence =\
            dictionary.get("occurrence")\
            if dictionary.get("occurrence")\
                else APIHelper.SKIP
        validation_indicator =\
            dictionary.get("validationIndicator")\
            if dictionary.get("validationIndicator")\
                else APIHelper.SKIP
        amount_type =\
            dictionary.get("amountType")\
            if dictionary.get("amountType")\
                else APIHelper.SKIP
        maximum_amount =\
            dictionary.get("maximumAmount")\
            if dictionary.get("maximumAmount")\
                else APIHelper.SKIP
        reference_number =\
            dictionary.get("referenceNumber")\
            if dictionary.get("referenceNumber")\
                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(end_date,
                   frequency,
                   number_of_payments,
                   original_purchase_date,
                   sequence_number,
                   mtype,
                   occurrence,
                   validation_indicator,
                   amount_type,
                   maximum_amount,
                   reference_number,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _end_date=self.end_date
        _frequency=self.frequency
        _number_of_payments=(
            self.number_of_payments
            if hasattr(self, "number_of_payments")
            else None
        )
        _original_purchase_date=(
            self.original_purchase_date
            if hasattr(self, "original_purchase_date")
            else None
        )
        _sequence_number=(
            self.sequence_number
            if hasattr(self, "sequence_number")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _occurrence=(
            self.occurrence
            if hasattr(self, "occurrence")
            else None
        )
        _validation_indicator=(
            self.validation_indicator
            if hasattr(self, "validation_indicator")
            else None
        )
        _amount_type=(
            self.amount_type
            if hasattr(self, "amount_type")
            else None
        )
        _maximum_amount=(
            self.maximum_amount
            if hasattr(self, "maximum_amount")
            else None
        )
        _reference_number=(
            self.reference_number
            if hasattr(self, "reference_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"end_date={_end_date!r}, "
            f"frequency={_frequency!r}, "
            f"number_of_payments={_number_of_payments!r}, "
            f"original_purchase_date={_original_purchase_date!r}, "
            f"sequence_number={_sequence_number!r}, "
            f"mtype={_mtype!r}, "
            f"occurrence={_occurrence!r}, "
            f"validation_indicator={_validation_indicator!r}, "
            f"amount_type={_amount_type!r}, "
            f"maximum_amount={_maximum_amount!r}, "
            f"reference_number={_reference_number!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _end_date=self.end_date
        _frequency=self.frequency
        _number_of_payments=(
            self.number_of_payments
            if hasattr(self, "number_of_payments")
            else None
        )
        _original_purchase_date=(
            self.original_purchase_date
            if hasattr(self, "original_purchase_date")
            else None
        )
        _sequence_number=(
            self.sequence_number
            if hasattr(self, "sequence_number")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _occurrence=(
            self.occurrence
            if hasattr(self, "occurrence")
            else None
        )
        _validation_indicator=(
            self.validation_indicator
            if hasattr(self, "validation_indicator")
            else None
        )
        _amount_type=(
            self.amount_type
            if hasattr(self, "amount_type")
            else None
        )
        _maximum_amount=(
            self.maximum_amount
            if hasattr(self, "maximum_amount")
            else None
        )
        _reference_number=(
            self.reference_number
            if hasattr(self, "reference_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"end_date={_end_date!s}, "
            f"frequency={_frequency!s}, "
            f"number_of_payments={_number_of_payments!s}, "
            f"original_purchase_date={_original_purchase_date!s}, "
            f"sequence_number={_sequence_number!s}, "
            f"mtype={_mtype!s}, "
            f"occurrence={_occurrence!s}, "
            f"validation_indicator={_validation_indicator!s}, "
            f"amount_type={_amount_type!s}, "
            f"maximum_amount={_maximum_amount!s}, "
            f"reference_number={_reference_number!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
