"""visaacceptancemergedspec.

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

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


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

    Attributes:
        reference_number (str): Unique value generated by Visa Acceptance that
            identifies the transaction. Use this value to identify transactions in
            the Collections Report, which provides settlement information.  For
            details, see the `direct_debit_reconciliation_reference_number` reply
            field description in [Ingenico ePayments Developer Guide For Direct
            Debits.](
        recurring_type (str): Whether the direct debit is the first or last direct
            debit associated with the mandate, or one in between. Required only for
            the United Kingdom. Possible values: - `001`: First direct debit
            associated with this mandate. Use this value if a one-time direct debit).
            - `002`: Subsequent direct debits associated with this mandate. - `003`:
            Last direct debit associated with this mandate.  For details, see the
            `direct_debit_recurring_type` request field description in [Ingenico
            ePayments Developer Guide For Direct Debits.](
        id (str): The mandate ID. Required only for the United Kingdom.  For details,
            see the `mandate_id` request field description in [Ingenico ePayments
            Developer Guide For Direct Debits.](
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reference_number": "referenceNumber",
        "recurring_type": "recurringType",
        "id": "id",
    }

    _optionals = [
        "reference_number",
        "recurring_type",
        "id",
    ]

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

        # 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
        reference_number =\
            dictionary.get("referenceNumber")\
            if dictionary.get("referenceNumber")\
                else APIHelper.SKIP
        recurring_type =\
            dictionary.get("recurringType")\
            if dictionary.get("recurringType")\
                else APIHelper.SKIP
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                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(reference_number,
                   recurring_type,
                   id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _reference_number=(
            self.reference_number
            if hasattr(self, "reference_number")
            else None
        )
        _recurring_type=(
            self.recurring_type
            if hasattr(self, "recurring_type")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reference_number={_reference_number!r}, "
            f"recurring_type={_recurring_type!r}, "
            f"id={_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _reference_number=(
            self.reference_number
            if hasattr(self, "reference_number")
            else None
        )
        _recurring_type=(
            self.recurring_type
            if hasattr(self, "recurring_type")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reference_number={_reference_number!s}, "
            f"recurring_type={_recurring_type!s}, "
            f"id={_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
