"""visaacceptancemergedspec.

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

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


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

    Attributes:
        name (str): The name of the Visa Acceptance transaction type (such as CC
            settlement or CC authorization) that the merchant wants to process in a
            transaction request. More than one transaction type can included in a
            transaction request. Each transaction type separately returns their own
            status, reasonCode, rCode, and rFlag messages.
        status (str): The description for this field is not available.
        reason_code (str): 3-digit reason code that indicates why the customer
            profile payment succeeded or failed.
        r_code (str): Indicates whether the service request was successful. Possible
            values:  - `-1`: An error occurred. - `0`: The request was declined. -
            `1`: The request was successful.
        r_flag (str): One-word description of the result of the application.
        reconciliation_id (str): Reference number that you use to reconcile your Visa
            Acceptance reports with your processor reports.
        r_message (str): Message that explains the reply flag for the application.
        return_code (int): The description for this field is not available.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": "name",
        "status": "status",
        "reason_code": "reasonCode",
        "r_code": "rCode",
        "r_flag": "rFlag",
        "reconciliation_id": "reconciliationId",
        "r_message": "rMessage",
        "return_code": "returnCode",
    }

    _optionals = [
        "name",
        "status",
        "reason_code",
        "r_code",
        "r_flag",
        "reconciliation_id",
        "r_message",
        "return_code",
    ]

    def __init__(
        self,
        name=APIHelper.SKIP,
        status=APIHelper.SKIP,
        reason_code=APIHelper.SKIP,
        r_code=APIHelper.SKIP,
        r_flag=APIHelper.SKIP,
        reconciliation_id=APIHelper.SKIP,
        r_message=APIHelper.SKIP,
        return_code=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Application instance."""
        # Initialize members of the class
        if name is not APIHelper.SKIP:
            self.name = name
        if status is not APIHelper.SKIP:
            self.status = status
        if reason_code is not APIHelper.SKIP:
            self.reason_code = reason_code
        if r_code is not APIHelper.SKIP:
            self.r_code = r_code
        if r_flag is not APIHelper.SKIP:
            self.r_flag = r_flag
        if reconciliation_id is not APIHelper.SKIP:
            self.reconciliation_id = reconciliation_id
        if r_message is not APIHelper.SKIP:
            self.r_message = r_message
        if return_code is not APIHelper.SKIP:
            self.return_code = return_code

        # 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
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else APIHelper.SKIP
        status =\
            dictionary.get("status")\
            if dictionary.get("status")\
                else APIHelper.SKIP
        reason_code =\
            dictionary.get("reasonCode")\
            if dictionary.get("reasonCode")\
                else APIHelper.SKIP
        r_code =\
            dictionary.get("rCode")\
            if dictionary.get("rCode")\
                else APIHelper.SKIP
        r_flag =\
            dictionary.get("rFlag")\
            if dictionary.get("rFlag")\
                else APIHelper.SKIP
        reconciliation_id =\
            dictionary.get("reconciliationId")\
            if dictionary.get("reconciliationId")\
                else APIHelper.SKIP
        r_message =\
            dictionary.get("rMessage")\
            if dictionary.get("rMessage")\
                else APIHelper.SKIP
        return_code =\
            dictionary.get("returnCode")\
            if dictionary.get("returnCode")\
                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(name,
                   status,
                   reason_code,
                   r_code,
                   r_flag,
                   reconciliation_id,
                   r_message,
                   return_code,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _r_code=(
            self.r_code
            if hasattr(self, "r_code")
            else None
        )
        _r_flag=(
            self.r_flag
            if hasattr(self, "r_flag")
            else None
        )
        _reconciliation_id=(
            self.reconciliation_id
            if hasattr(self, "reconciliation_id")
            else None
        )
        _r_message=(
            self.r_message
            if hasattr(self, "r_message")
            else None
        )
        _return_code=(
            self.return_code
            if hasattr(self, "return_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!r}, "
            f"status={_status!r}, "
            f"reason_code={_reason_code!r}, "
            f"r_code={_r_code!r}, "
            f"r_flag={_r_flag!r}, "
            f"reconciliation_id={_reconciliation_id!r}, "
            f"r_message={_r_message!r}, "
            f"return_code={_return_code!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _reason_code=(
            self.reason_code
            if hasattr(self, "reason_code")
            else None
        )
        _r_code=(
            self.r_code
            if hasattr(self, "r_code")
            else None
        )
        _r_flag=(
            self.r_flag
            if hasattr(self, "r_flag")
            else None
        )
        _reconciliation_id=(
            self.reconciliation_id
            if hasattr(self, "reconciliation_id")
            else None
        )
        _r_message=(
            self.r_message
            if hasattr(self, "r_message")
            else None
        )
        _return_code=(
            self.return_code
            if hasattr(self, "return_code")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!s}, "
            f"status={_status!s}, "
            f"reason_code={_reason_code!s}, "
            f"r_code={_r_code!s}, "
            f"r_flag={_r_flag!s}, "
            f"reconciliation_id={_reconciliation_id!s}, "
            f"r_message={_r_message!s}, "
            f"return_code={_return_code!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
