"""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_6 import (
    MerchantDescriptor6,
)


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

    Attributes:
        merchant_descriptor (MerchantDescriptor6): The model property of type
            MerchantDescriptor6.
        category_code (int): The value for this field is a four-digit number that the
            payment card industry uses to classify merchants into market segments. A
            payment card company assigned one or more of these values to your
            business when you started accepting the payment card company’s cards.
            When you do not include this field in your request, Visa Acceptance uses
            the value in your Visa Acceptance account.  #### Visa Acceptance through
            VisaNet The value for this field corresponds to the following data in the
            TC 33 capture file5: - Record: CP01 TCR4 - Position: 150-153 - Field:
            Merchant Category Code
        administrative_area (str): The state where the merchant is located.  #### PIN
            debit State code or region code for your business. Use the Use the
            [State, Province, and Territory Codes for the United States and Canada](
            This value might be displayed on the cardholder’s statement.  When you do
            not include this value in your PIN debit request, the merchant name from
            your account is used. **Important** This value must consist of English
            characters.  **Note** This field is supported only for businesses located
            in the U.S. or Canada.  Optional field for PIN debit credit or PIN debit
            purchase.
        transaction_local_date_time (str): Date and time at your physical location.
            Format: `YYYYMMDDhhmmss`, where:  - `YYYY` = year  - `MM` = month  - `DD`
            = day  - `hh` = hour  - `mm` = minutes  - `ss` = seconds  #### Used by
            **Authorization** Required for these processors: - American Express
            Direct
            - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global -
            SIX  Optional for all other processors.
        cancel_url (str): URL to which the customer is directed if they fail to sign
            the mandate. #### SEPA Required for Create Mandate and Update Mandate
            #### BACS Required for Create Mandate
        success_url (str): URL to which the customer is directed if they fail to sign
            the mandate. #### SEPA Required for Create Mandate and Update Mandate
            #### BACS Required for Create Mandate
        failure_url (str): URL to which the customer is directed if they fail to sign
            the mandate. #### SEPA Required for Create Mandate and Update Mandate
            #### BACS Required for Create Mandate
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "merchant_descriptor": "merchantDescriptor",
        "category_code": "categoryCode",
        "administrative_area": "administrativeArea",
        "transaction_local_date_time": "transactionLocalDateTime",
        "cancel_url": "cancelUrl",
        "success_url": "successUrl",
        "failure_url": "failureUrl",
    }

    _optionals = [
        "merchant_descriptor",
        "category_code",
        "administrative_area",
        "transaction_local_date_time",
        "cancel_url",
        "success_url",
        "failure_url",
    ]

    def __init__(
        self,
        merchant_descriptor=APIHelper.SKIP,
        category_code=APIHelper.SKIP,
        administrative_area=APIHelper.SKIP,
        transaction_local_date_time=APIHelper.SKIP,
        cancel_url=APIHelper.SKIP,
        success_url=APIHelper.SKIP,
        failure_url=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a MerchantInformation11 instance."""
        # Initialize members of the class
        if merchant_descriptor is not APIHelper.SKIP:
            self.merchant_descriptor = merchant_descriptor
        if category_code is not APIHelper.SKIP:
            self.category_code = category_code
        if administrative_area is not APIHelper.SKIP:
            self.administrative_area = administrative_area
        if transaction_local_date_time is not APIHelper.SKIP:
            self.transaction_local_date_time = transaction_local_date_time
        if cancel_url is not APIHelper.SKIP:
            self.cancel_url = cancel_url
        if success_url is not APIHelper.SKIP:
            self.success_url = success_url
        if failure_url is not APIHelper.SKIP:
            self.failure_url = failure_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_descriptor =\
            MerchantDescriptor6.from_dictionary(
                dictionary.get("merchantDescriptor"))\
                if "merchantDescriptor" in dictionary.keys()\
                else APIHelper.SKIP
        category_code =\
            dictionary.get("categoryCode")\
            if dictionary.get("categoryCode")\
                else APIHelper.SKIP
        administrative_area =\
            dictionary.get("administrativeArea")\
            if dictionary.get("administrativeArea")\
                else APIHelper.SKIP
        transaction_local_date_time =\
            dictionary.get("transactionLocalDateTime")\
            if dictionary.get("transactionLocalDateTime")\
                else APIHelper.SKIP
        cancel_url =\
            dictionary.get("cancelUrl")\
            if dictionary.get("cancelUrl")\
                else APIHelper.SKIP
        success_url =\
            dictionary.get("successUrl")\
            if dictionary.get("successUrl")\
                else APIHelper.SKIP
        failure_url =\
            dictionary.get("failureUrl")\
            if dictionary.get("failureUrl")\
                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_descriptor,
                   category_code,
                   administrative_area,
                   transaction_local_date_time,
                   cancel_url,
                   success_url,
                   failure_url,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _transaction_local_date_time=(
            self.transaction_local_date_time
            if hasattr(self, "transaction_local_date_time")
            else None
        )
        _cancel_url=(
            self.cancel_url
            if hasattr(self, "cancel_url")
            else None
        )
        _success_url=(
            self.success_url
            if hasattr(self, "success_url")
            else None
        )
        _failure_url=(
            self.failure_url
            if hasattr(self, "failure_url")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_descriptor={_merchant_descriptor!r}, "
            f"category_code={_category_code!r}, "
            f"administrative_area={_administrative_area!r}, "
            f"transaction_local_date_time={_transaction_local_date_time!r}, "
            f"cancel_url={_cancel_url!r}, "
            f"success_url={_success_url!r}, "
            f"failure_url={_failure_url!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _merchant_descriptor=(
            self.merchant_descriptor
            if hasattr(self, "merchant_descriptor")
            else None
        )
        _category_code=(
            self.category_code
            if hasattr(self, "category_code")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _transaction_local_date_time=(
            self.transaction_local_date_time
            if hasattr(self, "transaction_local_date_time")
            else None
        )
        _cancel_url=(
            self.cancel_url
            if hasattr(self, "cancel_url")
            else None
        )
        _success_url=(
            self.success_url
            if hasattr(self, "success_url")
            else None
        )
        _failure_url=(
            self.failure_url
            if hasattr(self, "failure_url")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_descriptor={_merchant_descriptor!s}, "
            f"category_code={_category_code!s}, "
            f"administrative_area={_administrative_area!s}, "
            f"transaction_local_date_time={_transaction_local_date_time!s}, "
            f"cancel_url={_cancel_url!s}, "
            f"success_url={_success_url!s}, "
            f"failure_url={_failure_url!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
