"""visaacceptancemergedspec.

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

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


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

    Attributes:
        first_name (str): First name of the recipient.  #### Litle Maximum length: 25
            #### All other processors Maximum length: 60  Optional field.
        last_name (str): Last name of the recipient.  #### Litle Maximum length: 25
            #### All other processors Maximum length: 60  Optional field.
        address_1 (str): First line of the shipping address.  Required field for
            authorization if any shipping address information is included in the
            request; otherwise, optional.  #### Tax Calculation Optional field for
            U.S. and Canadian taxes. Not applicable to international and value added
            taxes. Billing address objects will be used to determine the cardholder’s
            location when shipTo objects are not present.
        address_2 (str): Second line of the shipping address.  Optional field.  ####
            Tax Calculation Optional field for U.S. and Canadian taxes. Not
            applicable to international and value added taxes. Billing address
            objects will be used to determine the cardholder’s location when shipTo
            objects are not present.
        locality (str): City of the shipping address.  Required field for
            authorization if any shipping address information is included in the
            request and shipping to the U.S. or Canada; otherwise, optional.  ####
            Tax Calculation Optional field for U.S. and Canadian taxes. Not
            applicable to international and value added taxes. Billing address
            objects will be used to determine the cardholder’s location when shipTo
            objects are not present.
        administrative_area (str): State or province of the shipping address. Use the
            [State, Province, and Territory Codes for the United States and Canada](
            (maximum length: 2)   Required field for authorization if any shipping
            address information is included in the request and shipping to the U.S.
            or Canada; otherwise, optional.  #### Tax Calculation Optional field for
            U.S. and Canadian taxes. Not applicable to international and value added
            taxes. Billing address objects will be used to determine the cardholder’s
            location when shipTo objects are not present.
        postal_code (str): Postal code for the shipping address. The postal code must
            consist of 5 to 9 digits.  Required field for authorization if any
            shipping address information is included in the request and shipping to
            the U.S. or Canada; otherwise, optional.  When the billing country is the
            U.S., the 9-digit postal code must follow this format: [5 digits][dash][4
            digits]  Example 12345-6789  When the billing country is Canada, the
            6-digit postal code must follow this format:
            [alpha][numeric][alpha][space][numeric][alpha][numeric]  Example A1B 2C3
            #### American Express Direct Before sending the postal code to the
            processor, all nonalphanumeric characters are removed and, if the
            remaining value is longer than nine characters, the value is truncated
            starting from the right side. #### Tax Calculation Optional field for
            U.S. and Canadian taxes. Not applicable to international and value added
            taxes. Billing address objects will be used to determine the cardholder’s
            location when shipTo objects are not present.
        country (str): Country of the shipping address. Use the two-character [ISO
            Standard Country Codes.](  Required field for authorization if any
            shipping address information is included in the request; otherwise,
            optional.  #### Tax Calculation Optional field for U.S., Canadian,
            international tax, and value added taxes. Billing address objects will be
            used to determine the cardholder’s location when shipTo objects are not
            present.
        phone_number (str): Phone number associated with the shipping address.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "first_name": "firstName",
        "last_name": "lastName",
        "address_1": "address1",
        "address_2": "address2",
        "locality": "locality",
        "administrative_area": "administrativeArea",
        "postal_code": "postalCode",
        "country": "country",
        "phone_number": "phoneNumber",
    }

    _optionals = [
        "first_name",
        "last_name",
        "address_1",
        "address_2",
        "locality",
        "administrative_area",
        "postal_code",
        "country",
        "phone_number",
    ]

    def __init__(
        self,
        first_name=APIHelper.SKIP,
        last_name=APIHelper.SKIP,
        address_1=APIHelper.SKIP,
        address_2=APIHelper.SKIP,
        locality=APIHelper.SKIP,
        administrative_area=APIHelper.SKIP,
        postal_code=APIHelper.SKIP,
        country=APIHelper.SKIP,
        phone_number=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ShipTo6 instance."""
        # Initialize members of the class
        if first_name is not APIHelper.SKIP:
            self.first_name = first_name
        if last_name is not APIHelper.SKIP:
            self.last_name = last_name
        if address_1 is not APIHelper.SKIP:
            self.address_1 = address_1
        if address_2 is not APIHelper.SKIP:
            self.address_2 = address_2
        if locality is not APIHelper.SKIP:
            self.locality = locality
        if administrative_area is not APIHelper.SKIP:
            self.administrative_area = administrative_area
        if postal_code is not APIHelper.SKIP:
            self.postal_code = postal_code
        if country is not APIHelper.SKIP:
            self.country = country
        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
        first_name =\
            dictionary.get("firstName")\
            if dictionary.get("firstName")\
                else APIHelper.SKIP
        last_name =\
            dictionary.get("lastName")\
            if dictionary.get("lastName")\
                else APIHelper.SKIP
        address_1 =\
            dictionary.get("address1")\
            if dictionary.get("address1")\
                else APIHelper.SKIP
        address_2 =\
            dictionary.get("address2")\
            if dictionary.get("address2")\
                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
        postal_code =\
            dictionary.get("postalCode")\
            if dictionary.get("postalCode")\
                else APIHelper.SKIP
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                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(first_name,
                   last_name,
                   address_1,
                   address_2,
                   locality,
                   administrative_area,
                   postal_code,
                   country,
                   phone_number,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _first_name=(
            self.first_name
            if hasattr(self, "first_name")
            else None
        )
        _last_name=(
            self.last_name
            if hasattr(self, "last_name")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _address_2=(
            self.address_2
            if hasattr(self, "address_2")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            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"first_name={_first_name!r}, "
            f"last_name={_last_name!r}, "
            f"address_1={_address_1!r}, "
            f"address_2={_address_2!r}, "
            f"locality={_locality!r}, "
            f"administrative_area={_administrative_area!r}, "
            f"postal_code={_postal_code!r}, "
            f"country={_country!r}, "
            f"phone_number={_phone_number!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _first_name=(
            self.first_name
            if hasattr(self, "first_name")
            else None
        )
        _last_name=(
            self.last_name
            if hasattr(self, "last_name")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _address_2=(
            self.address_2
            if hasattr(self, "address_2")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            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"first_name={_first_name!s}, "
            f"last_name={_last_name!s}, "
            f"address_1={_address_1!s}, "
            f"address_2={_address_2!s}, "
            f"locality={_locality!s}, "
            f"administrative_area={_administrative_area!s}, "
            f"postal_code={_postal_code!s}, "
            f"country={_country!s}, "
            f"phone_number={_phone_number!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
