"""visaacceptancemergedspec.

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

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


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

    Attributes:
        reference (str): Mandate reference as returned on the first transaction in
            the sequence
        signature_date (str): Date of the initial transaction, format is YYYY-MM-DD.
            Date can be taken from the finaltimestamp of the SUCCEEDED notification
            for the first transaction in the sequence.
        url (str): Valid URL pointing to the SEPA mandate, needs to be accessible by
            our risk and compliance department.
        mtype (str): Sequence type of the direct debit, defaults to “oneOff”. Valid
            values: oneOff The direct debit is executed once. first First direct
            debit in a series of recurring ones.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reference": "reference",
        "signature_date": "signatureDate",
        "url": "url",
        "mtype": "type",
    }

    _optionals = [
        "reference",
        "signature_date",
        "url",
        "mtype",
    ]

    def __init__(
        self,
        reference=APIHelper.SKIP,
        signature_date=APIHelper.SKIP,
        url=APIHelper.SKIP,
        mtype=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a DirectDebitSepa instance."""
        # Initialize members of the class
        if reference is not APIHelper.SKIP:
            self.reference = reference
        if signature_date is not APIHelper.SKIP:
            self.signature_date = signature_date
        if url is not APIHelper.SKIP:
            self.url = url
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype

        # 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 =\
            dictionary.get("reference")\
            if dictionary.get("reference")\
                else APIHelper.SKIP
        signature_date =\
            dictionary.get("signatureDate")\
            if dictionary.get("signatureDate")\
                else APIHelper.SKIP
        url =\
            dictionary.get("url")\
            if dictionary.get("url")\
                else APIHelper.SKIP
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                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,
                   signature_date,
                   url,
                   mtype,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _reference=(
            self.reference
            if hasattr(self, "reference")
            else None
        )
        _signature_date=(
            self.signature_date
            if hasattr(self, "signature_date")
            else None
        )
        _url=(
            self.url
            if hasattr(self, "url")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reference={_reference!r}, "
            f"signature_date={_signature_date!r}, "
            f"url={_url!r}, "
            f"mtype={_mtype!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _reference=(
            self.reference
            if hasattr(self, "reference")
            else None
        )
        _signature_date=(
            self.signature_date
            if hasattr(self, "signature_date")
            else None
        )
        _url=(
            self.url
            if hasattr(self, "url")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"reference={_reference!s}, "
            f"signature_date={_signature_date!s}, "
            f"url={_url!s}, "
            f"mtype={_mtype!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
