"""visaacceptancemergedspec.

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

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


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

    Attributes:
        id (str): Identifier for the mandate.
        date_signed (str): Date the mandate has been signed.  Format YYYYMMdd
        date_created (str): Date the mandate has been created.  Format YYYYMMdd
        date_revoked (str): Date the mandate has been revoked.  Format YYYYMMdd
        encoded_html (str): Base64 encoded html string
        encoded_html_popup (str): Base64 encoded popup html string
        url (str): URL for redirecting the customer for creating the mandate.
        transaction_id (str): The Billing Agreement ID returned by processor (PayPal).
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "id",
        "date_signed": "dateSigned",
        "date_created": "dateCreated",
        "date_revoked": "dateRevoked",
        "encoded_html": "encodedHtml",
        "encoded_html_popup": "encodedHtmlPopup",
        "url": "url",
        "transaction_id": "transactionId",
    }

    _optionals = [
        "id",
        "date_signed",
        "date_created",
        "date_revoked",
        "encoded_html",
        "encoded_html_popup",
        "url",
        "transaction_id",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        date_signed=APIHelper.SKIP,
        date_created=APIHelper.SKIP,
        date_revoked=APIHelper.SKIP,
        encoded_html=APIHelper.SKIP,
        encoded_html_popup=APIHelper.SKIP,
        url=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a AgreementInformation9 instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if date_signed is not APIHelper.SKIP:
            self.date_signed = date_signed
        if date_created is not APIHelper.SKIP:
            self.date_created = date_created
        if date_revoked is not APIHelper.SKIP:
            self.date_revoked = date_revoked
        if encoded_html is not APIHelper.SKIP:
            self.encoded_html = encoded_html
        if encoded_html_popup is not APIHelper.SKIP:
            self.encoded_html_popup = encoded_html_popup
        if url is not APIHelper.SKIP:
            self.url = url
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_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
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else APIHelper.SKIP
        date_signed =\
            dictionary.get("dateSigned")\
            if dictionary.get("dateSigned")\
                else APIHelper.SKIP
        date_created =\
            dictionary.get("dateCreated")\
            if dictionary.get("dateCreated")\
                else APIHelper.SKIP
        date_revoked =\
            dictionary.get("dateRevoked")\
            if dictionary.get("dateRevoked")\
                else APIHelper.SKIP
        encoded_html =\
            dictionary.get("encodedHtml")\
            if dictionary.get("encodedHtml")\
                else APIHelper.SKIP
        encoded_html_popup =\
            dictionary.get("encodedHtmlPopup")\
            if dictionary.get("encodedHtmlPopup")\
                else APIHelper.SKIP
        url =\
            dictionary.get("url")\
            if dictionary.get("url")\
                else APIHelper.SKIP
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                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(id,
                   date_signed,
                   date_created,
                   date_revoked,
                   encoded_html,
                   encoded_html_popup,
                   url,
                   transaction_id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _date_signed=(
            self.date_signed
            if hasattr(self, "date_signed")
            else None
        )
        _date_created=(
            self.date_created
            if hasattr(self, "date_created")
            else None
        )
        _date_revoked=(
            self.date_revoked
            if hasattr(self, "date_revoked")
            else None
        )
        _encoded_html=(
            self.encoded_html
            if hasattr(self, "encoded_html")
            else None
        )
        _encoded_html_popup=(
            self.encoded_html_popup
            if hasattr(self, "encoded_html_popup")
            else None
        )
        _url=(
            self.url
            if hasattr(self, "url")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"date_signed={_date_signed!r}, "
            f"date_created={_date_created!r}, "
            f"date_revoked={_date_revoked!r}, "
            f"encoded_html={_encoded_html!r}, "
            f"encoded_html_popup={_encoded_html_popup!r}, "
            f"url={_url!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _date_signed=(
            self.date_signed
            if hasattr(self, "date_signed")
            else None
        )
        _date_created=(
            self.date_created
            if hasattr(self, "date_created")
            else None
        )
        _date_revoked=(
            self.date_revoked
            if hasattr(self, "date_revoked")
            else None
        )
        _encoded_html=(
            self.encoded_html
            if hasattr(self, "encoded_html")
            else None
        )
        _encoded_html_popup=(
            self.encoded_html_popup
            if hasattr(self, "encoded_html_popup")
            else None
        )
        _url=(
            self.url
            if hasattr(self, "url")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"date_signed={_date_signed!s}, "
            f"date_created={_date_created!s}, "
            f"date_revoked={_date_revoked!s}, "
            f"encoded_html={_encoded_html!s}, "
            f"encoded_html_popup={_encoded_html_popup!s}, "
            f"url={_url!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
