"""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.merchant_descriptor_1 import (
    MerchantDescriptor1,
)


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

    Attributes:
        merchant_name (str): Use this field only if you are requesting payment with
            Payer Authentication serice together.  Your company’s name as you want it
            to appear to the customer in the issuing bank’s authentication form. This
            value overrides the value specified by your merchant bank.
        merchant_descriptor (MerchantDescriptor1): The model property of type
            MerchantDescriptor1.
        return_url (str): URL for displaying payment results to the consumer
            (notifications) after the transaction is processed. Usually this URL
            belongs to merchant and its behavior is defined by merchant
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "merchant_name": "merchantName",
        "merchant_descriptor": "merchantDescriptor",
        "return_url": "returnUrl",
    }

    _optionals = [
        "merchant_name",
        "merchant_descriptor",
        "return_url",
    ]

    def __init__(
        self,
        merchant_name=APIHelper.SKIP,
        merchant_descriptor=APIHelper.SKIP,
        return_url=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a MerchantInformation1 instance."""
        # Initialize members of the class
        if merchant_name is not APIHelper.SKIP:
            self.merchant_name = merchant_name
        if merchant_descriptor is not APIHelper.SKIP:
            self.merchant_descriptor = merchant_descriptor
        if return_url is not APIHelper.SKIP:
            self.return_url = return_url

        # 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
        merchant_name =\
            dictionary.get("merchantName")\
            if dictionary.get("merchantName")\
                else APIHelper.SKIP
        merchant_descriptor =\
            MerchantDescriptor1.from_dictionary(
                dictionary.get("merchantDescriptor"))\
                if "merchantDescriptor" in dictionary.keys()\
                else APIHelper.SKIP
        return_url =\
            dictionary.get("returnUrl")\
            if dictionary.get("returnUrl")\
                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(merchant_name,
                   merchant_descriptor,
                   return_url,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _merchant_name=(
            self.merchant_name
            if hasattr(self, "merchant_name")
            else None
        )
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _return_url=(
            self.return_url
            if hasattr(self, "return_url")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_name={_merchant_name!r}, "
            f"merchant_descriptor={_merchant_descriptor!r}, "
            f"return_url={_return_url!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _merchant_name=(
            self.merchant_name
            if hasattr(self, "merchant_name")
            else None
        )
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _return_url=(
            self.return_url
            if hasattr(self, "return_url")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_name={_merchant_name!s}, "
            f"merchant_descriptor={_merchant_descriptor!s}, "
            f"return_url={_return_url!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
