"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.order_information_32 import (
    OrderInformation32,
)
from visaacceptancemergedspec.models.payment_information_30 import (
    PaymentInformation30,
)


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

    Attributes:
        id (str): An unique identification number generated by Visa Acceptance to
            identify the submitted request. Returned by all services. It is also
            appended to the endpoint of the resource. On incremental authorizations,
            this value with be the same as the identification number returned in the
            original authorization response.
        status (str): The status of the request.  Possible values:  - COMPLETED
        payment_information (PaymentInformation30): The model property of type
            PaymentInformation30.
        order_information (OrderInformation32): The model property of type
            OrderInformation32.
        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",
        "status": "status",
        "payment_information": "paymentInformation",
        "order_information": "orderInformation",
    }

    _optionals = [
        "id",
        "status",
        "payment_information",
        "order_information",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        status=APIHelper.SKIP,
        payment_information=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RetrieveOrDeletePaymentTokenResponse instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if status is not APIHelper.SKIP:
            self.status = status
        if payment_information is not APIHelper.SKIP:
            self.payment_information = payment_information
        if order_information is not APIHelper.SKIP:
            self.order_information = order_information

        # 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
        status =\
            dictionary.get("status")\
            if dictionary.get("status")\
                else APIHelper.SKIP
        payment_information =\
            PaymentInformation30.from_dictionary(
                dictionary.get("paymentInformation"))\
                if "paymentInformation" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation32.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" in dictionary.keys()\
                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,
                   status,
                   payment_information,
                   order_information,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"status={_status!r}, "
            f"payment_information={_payment_information!r}, "
            f"order_information={_order_information!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
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _payment_information=(
            self.payment_information
            if hasattr(self, "payment_information")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"status={_status!s}, "
            f"payment_information={_payment_information!s}, "
            f"order_information={_order_information!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
