"""visaacceptancemergedspec.

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

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


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

    Attributes:
        postal_code (str): Merchant's postal code.  #### PIN debit Postal code for
            your business location. This value might be displayed on the cardholder’s
            statement.  If your business is domiciled in the U.S., you can use a
            5-digit or 9-digit postal code. A 9-digit postal code must follow this
            format: [5 digits][dash][4 digits] Example: `12345-6789`  If your
            business is domiciled in Canada, you can use a 6-digit or 9-digit postal
            code. A 6-digit postal code must follow this format:
            [alpha][numeric][alpha][space] [numeric][alpha][numeric] Example: `A1B
            2C3`  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. **Important** Mastercard
            requires a postal code for any country that uses postal codes. You can
            provide the postal code in your account or you can include this field in
            your request.  Optional field for PIN debit credit or PIN debit purchase.
        contact (str): Contact information for the merchant.  **Note** These are the
            maximum data lengths for the following payment processors: - FDCCompass
            (13) - Paymentech (13)
        locality (str): Merchant's City.  #### PIN debit City for your business
            location. 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.  Optional field for PIN debit credit or
            PIN debit purchase requests.
        name (str): Your merchant name.  **Note** For Paymentech processor using Visa
            Acceptance Payouts, the maximum data length is 22.  #### PIN debit Your
            business name. This name is displayed on the cardholder’s statement. When
            you include more than one consecutive space, extra spaces are removed.
            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.  Optional field for PIN debit credit or
            PIN debit purchase requests.  #### Airline processing Your merchant name.
            This name is displayed on the cardholder’s statement. When you include
            more than one consecutive space, extra spaces are removed.  **Note** Some
            airline fee programs may require the original ticket number (ticket
            identifier) or the ancillary service description in positions 13 through
            23 of this field.  **Important** This value must consist of English
            characters.  Required for captures and credits.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "postal_code": "postalCode",
        "contact": "contact",
        "locality": "locality",
        "name": "name",
    }

    _optionals = [
        "postal_code",
        "contact",
        "locality",
        "name",
    ]

    def __init__(
        self,
        postal_code=APIHelper.SKIP,
        contact=APIHelper.SKIP,
        locality=APIHelper.SKIP,
        name=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a MerchantDescriptor6 instance."""
        # Initialize members of the class
        if postal_code is not APIHelper.SKIP:
            self.postal_code = postal_code
        if contact is not APIHelper.SKIP:
            self.contact = contact
        if locality is not APIHelper.SKIP:
            self.locality = locality
        if name is not APIHelper.SKIP:
            self.name = name

        # 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
        postal_code =\
            dictionary.get("postalCode")\
            if dictionary.get("postalCode")\
                else APIHelper.SKIP
        contact =\
            dictionary.get("contact")\
            if dictionary.get("contact")\
                else APIHelper.SKIP
        locality =\
            dictionary.get("locality")\
            if dictionary.get("locality")\
                else APIHelper.SKIP
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                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(postal_code,
                   contact,
                   locality,
                   name,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _contact=(
            self.contact
            if hasattr(self, "contact")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"postal_code={_postal_code!r}, "
            f"contact={_contact!r}, "
            f"locality={_locality!r}, "
            f"name={_name!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _contact=(
            self.contact
            if hasattr(self, "contact")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"postal_code={_postal_code!s}, "
            f"contact={_contact!s}, "
            f"locality={_locality!s}, "
            f"name={_name!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
