"""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.partner import (
    Partner,
)


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

    Attributes:
        code (str): Merchant-generated order reference or tracking number. It is
            recommended that you send a unique value for each transaction so that you
            can perform meaningful searches for the transaction.  #### Used by  ####
            SEPA/BACS Required for mandates services #### Paypal Required for billing
            agreements   **Authorization** Required field.  #### PIN Debit Requests
            for PIN debit reversals need to use the same merchant reference number
            that was used in the transaction that is being reversed.  Required field
            for all PIN Debit requests (purchase, credit, and reversal).  #### FDC
            Nashville Global Certain circumstances can cause the processor to
            truncate this value to 15 or 17 characters for Level II and Level III
            processing, which can cause a discrepancy between the value you submit
            and the value included in some processor reports.
        reconciliation_id (str): Reference number for the transaction. Depending on
            how your Visa Acceptance account is configured, this value could either
            be provided in the API request or generated by Visa Acceptance. The
            actual value used in the request to the processor is provided back to you
            by Visa Acceptance in the response.
        paused_request_id (str): Used to resume a transaction that was paused for an
            order modification rule to allow for payer authentication to complete. To
            resume and continue with the authorization/decision service flow, call
            the services and include the request id from the prior decision call.
        transaction_id (str): Identifier that you assign to the transaction. Normally
            generated by a client server to identify a unique API request.  **Note**
            Use this field only if you want to support merchant-initiated reversal
            and void operations.  #### Used by **Authorization, Authorization
            Reversal, Capture, Credit, and Void** Optional field.  #### PIN Debit For
            a PIN debit reversal, your request must include a request ID or a
            merchant transaction identifier. Optional field for PIN debit purchase or
            credit requests.
        comments (str): Brief description of the order or any comment you wish to add
            to the order.
        partner (Partner): The model property of type Partner.
        application_name (str): The name of the Connection Method client (such as
            Virtual Terminal or SOAP Toolkit API) that the merchant uses to send a
            transaction request to Visa Acceptance.
        application_version (str): Version of the Visa Acceptance application or
            integration used for a transaction.
        application_user (str): The entity that is responsible for running the
            transaction and submitting the processing request to Visa Acceptance.
            This could be a person, a system, or a connection method.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "code": "code",
        "reconciliation_id": "reconciliationId",
        "paused_request_id": "pausedRequestId",
        "transaction_id": "transactionId",
        "comments": "comments",
        "partner": "partner",
        "application_name": "applicationName",
        "application_version": "applicationVersion",
        "application_user": "applicationUser",
    }

    _optionals = [
        "code",
        "reconciliation_id",
        "paused_request_id",
        "transaction_id",
        "comments",
        "partner",
        "application_name",
        "application_version",
        "application_user",
    ]

    def __init__(
        self,
        code=APIHelper.SKIP,
        reconciliation_id=APIHelper.SKIP,
        paused_request_id=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        comments=APIHelper.SKIP,
        partner=APIHelper.SKIP,
        application_name=APIHelper.SKIP,
        application_version=APIHelper.SKIP,
        application_user=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ClientReferenceInformation28 instance."""
        # Initialize members of the class
        if code is not APIHelper.SKIP:
            self.code = code
        if reconciliation_id is not APIHelper.SKIP:
            self.reconciliation_id = reconciliation_id
        if paused_request_id is not APIHelper.SKIP:
            self.paused_request_id = paused_request_id
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_id
        if comments is not APIHelper.SKIP:
            self.comments = comments
        if partner is not APIHelper.SKIP:
            self.partner = partner
        if application_name is not APIHelper.SKIP:
            self.application_name = application_name
        if application_version is not APIHelper.SKIP:
            self.application_version = application_version
        if application_user is not APIHelper.SKIP:
            self.application_user = application_user

        # 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
        code =\
            dictionary.get("code")\
            if dictionary.get("code")\
                else APIHelper.SKIP
        reconciliation_id =\
            dictionary.get("reconciliationId")\
            if dictionary.get("reconciliationId")\
                else APIHelper.SKIP
        paused_request_id =\
            dictionary.get("pausedRequestId")\
            if dictionary.get("pausedRequestId")\
                else APIHelper.SKIP
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                else APIHelper.SKIP
        comments =\
            dictionary.get("comments")\
            if dictionary.get("comments")\
                else APIHelper.SKIP
        partner =\
            Partner.from_dictionary(
                dictionary.get("partner"))\
                if "partner" in dictionary.keys()\
                else APIHelper.SKIP
        application_name =\
            dictionary.get("applicationName")\
            if dictionary.get("applicationName")\
                else APIHelper.SKIP
        application_version =\
            dictionary.get("applicationVersion")\
            if dictionary.get("applicationVersion")\
                else APIHelper.SKIP
        application_user =\
            dictionary.get("applicationUser")\
            if dictionary.get("applicationUser")\
                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(code,
                   reconciliation_id,
                   paused_request_id,
                   transaction_id,
                   comments,
                   partner,
                   application_name,
                   application_version,
                   application_user,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _code=(
            self.code
            if hasattr(self, "code")
            else None
        )
        _reconciliation_id=(
            self.reconciliation_id
            if hasattr(self, "reconciliation_id")
            else None
        )
        _paused_request_id=(
            self.paused_request_id
            if hasattr(self, "paused_request_id")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _comments=(
            self.comments
            if hasattr(self, "comments")
            else None
        )
        _partner=(
            self.partner
            if hasattr(self, "partner")
            else None
        )
        _application_name=(
            self.application_name
            if hasattr(self, "application_name")
            else None
        )
        _application_version=(
            self.application_version
            if hasattr(self, "application_version")
            else None
        )
        _application_user=(
            self.application_user
            if hasattr(self, "application_user")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"code={_code!r}, "
            f"reconciliation_id={_reconciliation_id!r}, "
            f"paused_request_id={_paused_request_id!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"comments={_comments!r}, "
            f"partner={_partner!r}, "
            f"application_name={_application_name!r}, "
            f"application_version={_application_version!r}, "
            f"application_user={_application_user!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _code=(
            self.code
            if hasattr(self, "code")
            else None
        )
        _reconciliation_id=(
            self.reconciliation_id
            if hasattr(self, "reconciliation_id")
            else None
        )
        _paused_request_id=(
            self.paused_request_id
            if hasattr(self, "paused_request_id")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _comments=(
            self.comments
            if hasattr(self, "comments")
            else None
        )
        _partner=(
            self.partner
            if hasattr(self, "partner")
            else None
        )
        _application_name=(
            self.application_name
            if hasattr(self, "application_name")
            else None
        )
        _application_version=(
            self.application_version
            if hasattr(self, "application_version")
            else None
        )
        _application_user=(
            self.application_user
            if hasattr(self, "application_user")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"code={_code!s}, "
            f"reconciliation_id={_reconciliation_id!s}, "
            f"paused_request_id={_paused_request_id!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"comments={_comments!s}, "
            f"partner={_partner!s}, "
            f"application_name={_application_name!s}, "
            f"application_version={_application_version!s}, "
            f"application_user={_application_user!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
