"""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.exceptions.api_exception import (
    ApiException,
)


class PtsV2VoidsPost502Response1Exception(ApiException):
    def __init__(self, reason, response):
        """Initialize PtsV2VoidsPost502Response1Exception object.

        Args:
            reason (string): The reason (or error message) for the Exception
                to be raised.
            response (HttpResponse): The HttpResponse of the API call.

        """
        super(PtsV2VoidsPost502Response1Exception, self).__init__(reason, response)
        dictionary = APIHelper.json_deserialize(self.response.text)
        if isinstance(dictionary, dict):
            self.unbox(dictionary)

    def unbox(self, dictionary):
        """Populate the properties of this object by extracting them 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.

        """
        self.submit_time_utc =\
            dictionary.get("submitTimeUtc")\
            if dictionary.get("submitTimeUtc")\
                else None
        self.status =\
            dictionary.get("status")\
            if dictionary.get("status")\
                else None
        self.reason =\
            dictionary.get("reason")\
            if dictionary.get("reason")\
                else None
        self.message =\
            dictionary.get("message")\
            if dictionary.get("message")\
                else None


    def __str__(self):
        """Return a human-readable string representation."""
        _submit_time_utc=(
            self.submit_time_utc
            if hasattr(self, "submit_time_utc")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _reason=(
            self.reason
            if hasattr(self, "reason")
            else None
        )
        _message=(
            self.message
            if hasattr(self, "message")
            else None
        )
        _base_str = super().__str__()
        _base_str = _base_str[_base_str.find("(") + 1:-1]
        return (
            f"{self.__class__.__name__}("
            f"base_str={_base_str!s}, "
            f"submit_time_utc={_submit_time_utc!s}, "
            f"status={_status!s}, "
            f"reason={_reason!s}, "
            f"message={_message!s}, "
            f")"
        )
