"""visaacceptancemergedspec.

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

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


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

    Attributes:
        card_acceptor_id (str): Unique identifier assigned by the payment card
            company to the sub-merchant.
        id (str): The ID you assigned to your sub-merchant. Visa Acceptance through
            VisaNet: For American Express transaction, the value for this field
            corresponds to the following data in the TC 33 capture file: - Record:
            CP01 TCRB - Position: 65-84 - Field: American Express Seller ID For
            Mastercard transactions, the value for this field corresponds to the
            following data in the TC 33 capture file: - Record: CP01 TCR6 - Position:
            117-131 - Field: Sub-Merchant ID FDC Compass: This value must consist of
            uppercase characters.  American Express Direct: String (20) Visa
            Acceptance through VisaNet with American Express: String (20) Visa
            Acceptance through VisaNet with Visa,Mastercard and Discover: String (15)
            FDC Compass: String (20) FDC Nashville Global: String (14)
        name (str): Sub-merchant’s business name.  #### American Express Direct The
            maximum length of the sub-merchant name depends on the length of the
            aggregator name. The combined length for both values must not exceed 36
            characters.  #### Visa Acceptance through VisaNet With American Express,
            the maximum length of the sub-merchant name depends on the length of the
            aggregator name. The combined length for both values must not exceed 36
            characters. The value for this field does not map to the TC 33 capture
            file5.  #### FDC Compass This value must consist of uppercase characters.
            #### FDC Nashville Global With Mastercard, the maximum length of the
            sub-merchant name depends on the length of the aggregator name: - If
            aggregator name length is 1 through 3, maximum sub-merchant name length
            is 21. - If aggregator name length is 4 through 7, maximum sub-merchant
            name length is 17. - If aggregator name length is 8 through 12, maximum
            sub-merchant name length is 12.
        address_1 (str): First line of the sub-merchant’s street address.  #### Visa
            Acceptance through VisaNet The value for this field does not map to the
            TC 33 capture file5.  #### FDC Compass This value must consist of
            uppercase characters.
        locality (str): Sub-merchant’s city.  #### Visa Acceptance through VisaNet
            The value for this field does not map to the TC 33 capture file5.  ####
            FDC Compass This value must consist of uppercase characters.
        administrative_area (str): Sub-merchant’s state or province.  #### Visa
            Acceptance through VisaNet The value for this field does not map to the
            TC 33 capture file5.  #### FDC Compass This value must consist of
            uppercase characters.
        region (str): Sub-merchant’s region.  **Example**\ `NE` indicates that the
            sub-merchant is in the northeast region.
        postal_code (str): Partial postal code for the sub-merchant’s address.  ####
            Visa Acceptance through VisaNet The value for this field does not map to
            the TC 33 capture file5.  #### FDC Compass This value must consist of
            uppercase characters.
        country (str): Sub-merchant’s country. Use the [ISO Standard Country Codes](
            #### Visa Acceptance through VisaNet The value for this field does not
            map to the TC 33 capture file.  #### FDC Compass This value must consist
            of uppercase characters.
        email (str): Sub-merchant’s email address.  **Maximum length for processors**
            - American Express Direct: 40  - Visa Acceptance through VisaNet: 40  -
            FDC Compass: 40  - FDC Nashville Global: 19  #### Visa Acceptance through
            VisaNet With American Express, the value for this field corresponds to
            the following data in the TC 33 capture file: - Record: CP01 TCRB -
            Position: 25-64 - Field: American Express Seller E-mail Address  **Note**
            The TC 33 Capture file contains information about the purchases and
            refunds that a merchant submits to Visa Acceptance. Visa Acceptance
            through VisaNet creates the TC 33 Capture file at the end of the day and
            sends it to the merchant’s acquirer, who uses this information to
            facilitate end-of-day clearing processing with payment card companies.
        phone_number (str): Sub-merchant’s telephone number.  **Maximum length for
            procesors**   - American Express Direct: 20  - Visa Acceptance through
            VisaNet: 20  - FDC Compass: 13  - FDC Nashville Global: 10  #### Visa
            Acceptance through VisaNet With American Express, the value for this
            field corresponds to the following data in the TC 33 capture file5: -
            Record: CP01 TCRB - Position: 5-24 - Field: American Express Seller
            Telephone Number  **FDC Compass**\ This value must consist of uppercase
            characters. Use one of these recommended formats:\ `NNN-NNN-NNNN`\
            `NNN-AAAAAAA`
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "card_acceptor_id": "cardAcceptorId",
        "id": "id",
        "name": "name",
        "address_1": "address1",
        "locality": "locality",
        "administrative_area": "administrativeArea",
        "region": "region",
        "postal_code": "postalCode",
        "country": "country",
        "email": "email",
        "phone_number": "phoneNumber",
    }

    _optionals = [
        "card_acceptor_id",
        "id",
        "name",
        "address_1",
        "locality",
        "administrative_area",
        "region",
        "postal_code",
        "country",
        "email",
        "phone_number",
    ]

    def __init__(
        self,
        card_acceptor_id=APIHelper.SKIP,
        id=APIHelper.SKIP,
        name=APIHelper.SKIP,
        address_1=APIHelper.SKIP,
        locality=APIHelper.SKIP,
        administrative_area=APIHelper.SKIP,
        region=APIHelper.SKIP,
        postal_code=APIHelper.SKIP,
        country=APIHelper.SKIP,
        email=APIHelper.SKIP,
        phone_number=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a SubMerchant instance."""
        # Initialize members of the class
        if card_acceptor_id is not APIHelper.SKIP:
            self.card_acceptor_id = card_acceptor_id
        if id is not APIHelper.SKIP:
            self.id = id
        if name is not APIHelper.SKIP:
            self.name = name
        if address_1 is not APIHelper.SKIP:
            self.address_1 = address_1
        if locality is not APIHelper.SKIP:
            self.locality = locality
        if administrative_area is not APIHelper.SKIP:
            self.administrative_area = administrative_area
        if region is not APIHelper.SKIP:
            self.region = region
        if postal_code is not APIHelper.SKIP:
            self.postal_code = postal_code
        if country is not APIHelper.SKIP:
            self.country = country
        if email is not APIHelper.SKIP:
            self.email = email
        if phone_number is not APIHelper.SKIP:
            self.phone_number = phone_number

        # 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
        card_acceptor_id =\
            dictionary.get("cardAcceptorId")\
            if dictionary.get("cardAcceptorId")\
                else APIHelper.SKIP
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else APIHelper.SKIP
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else APIHelper.SKIP
        address_1 =\
            dictionary.get("address1")\
            if dictionary.get("address1")\
                else APIHelper.SKIP
        locality =\
            dictionary.get("locality")\
            if dictionary.get("locality")\
                else APIHelper.SKIP
        administrative_area =\
            dictionary.get("administrativeArea")\
            if dictionary.get("administrativeArea")\
                else APIHelper.SKIP
        region =\
            dictionary.get("region")\
            if dictionary.get("region")\
                else APIHelper.SKIP
        postal_code =\
            dictionary.get("postalCode")\
            if dictionary.get("postalCode")\
                else APIHelper.SKIP
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else APIHelper.SKIP
        email =\
            dictionary.get("email")\
            if dictionary.get("email")\
                else APIHelper.SKIP
        phone_number =\
            dictionary.get("phoneNumber")\
            if dictionary.get("phoneNumber")\
                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(card_acceptor_id,
                   id,
                   name,
                   address_1,
                   locality,
                   administrative_area,
                   region,
                   postal_code,
                   country,
                   email,
                   phone_number,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _card_acceptor_id=(
            self.card_acceptor_id
            if hasattr(self, "card_acceptor_id")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _region=(
            self.region
            if hasattr(self, "region")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _email=(
            self.email
            if hasattr(self, "email")
            else None
        )
        _phone_number=(
            self.phone_number
            if hasattr(self, "phone_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"card_acceptor_id={_card_acceptor_id!r}, "
            f"id={_id!r}, "
            f"name={_name!r}, "
            f"address_1={_address_1!r}, "
            f"locality={_locality!r}, "
            f"administrative_area={_administrative_area!r}, "
            f"region={_region!r}, "
            f"postal_code={_postal_code!r}, "
            f"country={_country!r}, "
            f"email={_email!r}, "
            f"phone_number={_phone_number!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _card_acceptor_id=(
            self.card_acceptor_id
            if hasattr(self, "card_acceptor_id")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _region=(
            self.region
            if hasattr(self, "region")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _email=(
            self.email
            if hasattr(self, "email")
            else None
        )
        _phone_number=(
            self.phone_number
            if hasattr(self, "phone_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"card_acceptor_id={_card_acceptor_id!s}, "
            f"id={_id!s}, "
            f"name={_name!s}, "
            f"address_1={_address_1!s}, "
            f"locality={_locality!s}, "
            f"administrative_area={_administrative_area!s}, "
            f"region={_region!s}, "
            f"postal_code={_postal_code!s}, "
            f"country={_country!s}, "
            f"email={_email!s}, "
            f"phone_number={_phone_number!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
