"""visaacceptancemergedspec.

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

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


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

    Attributes:
        method (str): shipping method for the product. Possible values are: -
            `sameday` - `oneday` - `twoday` - `threeday` - `lowcost` - `pickup` -
            `other` - `none`
        first_name (str): First name of the recipient.
        last_name (str): Last name of the recipient.
        address_1 (str): First line of the shipping address.
        address_2 (str): Second line of the shipping address
        locality (str): City of the shipping address.
        postal_code (str): Postal code of shipping address. Consists of 5 to 9 digits.
        administrative_area (str): State or province of shipping address. This is a
            State, Province, and Territory Codes for the United States and Canada.
        country (str): Country of shipping address. This is a two-character ISO
            Standard Country Codes.
        phone_number (str): Phone number of 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 = {
        "method": "method",
        "first_name": "firstName",
        "last_name": "lastName",
        "address_1": "address1",
        "address_2": "address2",
        "locality": "locality",
        "postal_code": "postalCode",
        "administrative_area": "administrativeArea",
        "country": "country",
        "phone_number": "phoneNumber",
    }

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

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

    def __repr__(self):
        """Return a unambiguous string representation."""
        _method=(
            self.method
            if hasattr(self, "method")
            else None
        )
        _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
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            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"method={_method!r}, "
            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"postal_code={_postal_code!r}, "
            f"administrative_area={_administrative_area!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."""
        _method=(
            self.method
            if hasattr(self, "method")
            else None
        )
        _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
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _administrative_area=(
            self.administrative_area
            if hasattr(self, "administrative_area")
            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"method={_method!s}, "
            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"postal_code={_postal_code!s}, "
            f"administrative_area={_administrative_area!s}, "
            f"country={_country!s}, "
            f"phone_number={_phone_number!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
