"""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_16 import (
    Partner16,
)


class ClientReferenceInformation47(object):
    """Implementation of the 'ClientReferenceInformation47' 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
            **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.
        application_version (str): Version of the Visa Acceptance application or
            integration used for a transaction.
        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_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.
        partner (Partner16): The model property of type Partner16.
        comments (str): Brief description of the order or any comment you wish to add
            to the order.
        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",
        "application_version": "applicationVersion",
        "application_name": "applicationName",
        "application_user": "applicationUser",
        "partner": "partner",
        "comments": "comments",
    }

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

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

        # 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
        application_version =\
            dictionary.get("applicationVersion")\
            if dictionary.get("applicationVersion")\
                else APIHelper.SKIP
        application_name =\
            dictionary.get("applicationName")\
            if dictionary.get("applicationName")\
                else APIHelper.SKIP
        application_user =\
            dictionary.get("applicationUser")\
            if dictionary.get("applicationUser")\
                else APIHelper.SKIP
        partner =\
            Partner16.from_dictionary(
                dictionary.get("partner"))\
                if "partner" in dictionary.keys()\
                else APIHelper.SKIP
        comments =\
            dictionary.get("comments")\
            if dictionary.get("comments")\
                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,
                   application_version,
                   application_name,
                   application_user,
                   partner,
                   comments,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _code=(
            self.code
            if hasattr(self, "code")
            else None
        )
        _application_version=(
            self.application_version
            if hasattr(self, "application_version")
            else None
        )
        _application_name=(
            self.application_name
            if hasattr(self, "application_name")
            else None
        )
        _application_user=(
            self.application_user
            if hasattr(self, "application_user")
            else None
        )
        _partner=(
            self.partner
            if hasattr(self, "partner")
            else None
        )
        _comments=(
            self.comments
            if hasattr(self, "comments")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"code={_code!r}, "
            f"application_version={_application_version!r}, "
            f"application_name={_application_name!r}, "
            f"application_user={_application_user!r}, "
            f"partner={_partner!r}, "
            f"comments={_comments!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
        )
        _application_version=(
            self.application_version
            if hasattr(self, "application_version")
            else None
        )
        _application_name=(
            self.application_name
            if hasattr(self, "application_name")
            else None
        )
        _application_user=(
            self.application_user
            if hasattr(self, "application_user")
            else None
        )
        _partner=(
            self.partner
            if hasattr(self, "partner")
            else None
        )
        _comments=(
            self.comments
            if hasattr(self, "comments")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"code={_code!s}, "
            f"application_version={_application_version!s}, "
            f"application_name={_application_name!s}, "
            f"application_user={_application_user!s}, "
            f"partner={_partner!s}, "
            f"comments={_comments!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
