"""visaacceptancemergedspec.

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

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


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

    Attributes:
        city (str): City where the auto was returned to the rental agency.
        state (str): State in which the auto was returned to the rental agency. Use
            the [State, Province, and Territory Codes for the United States and
            Canada](  For authorizations, this field is supported for Visa,
            MasterCard, and American Express.  For captures, this field is supported
            only for MasterCard and American Express.
        country (str): Country where the auto was returned to the rental agency. Use
            the [ISO Standard Country Codes](
        location_id (str): Code, address, phone number, etc. used to identify the
            location of the auto rental return. This field is supported only for
            MasterCard and American Express.
        address_1 (str): When merchant wants to send the rental address's street
            address.
        postal_code (str): When merchant wants to send the return address's postal
            code.
        location (str): This field contains the location where the taxi passenger was
            dropped off or where the auto rental vehicle was returned.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "city": "city",
        "state": "state",
        "country": "country",
        "location_id": "locationId",
        "address_1": "address1",
        "postal_code": "postalCode",
        "location": "location",
    }

    _optionals = [
        "city",
        "state",
        "country",
        "location_id",
        "address_1",
        "postal_code",
        "location",
    ]

    def __init__(
        self,
        city=APIHelper.SKIP,
        state=APIHelper.SKIP,
        country=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        address_1=APIHelper.SKIP,
        postal_code=APIHelper.SKIP,
        location=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ReturnAddress instance."""
        # Initialize members of the class
        if city is not APIHelper.SKIP:
            self.city = city
        if state is not APIHelper.SKIP:
            self.state = state
        if country is not APIHelper.SKIP:
            self.country = country
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if address_1 is not APIHelper.SKIP:
            self.address_1 = address_1
        if postal_code is not APIHelper.SKIP:
            self.postal_code = postal_code
        if location is not APIHelper.SKIP:
            self.location = location

        # 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
        city =\
            dictionary.get("city")\
            if dictionary.get("city")\
                else APIHelper.SKIP
        state =\
            dictionary.get("state")\
            if dictionary.get("state")\
                else APIHelper.SKIP
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("locationId")\
            if dictionary.get("locationId")\
                else APIHelper.SKIP
        address_1 =\
            dictionary.get("address1")\
            if dictionary.get("address1")\
                else APIHelper.SKIP
        postal_code =\
            dictionary.get("postalCode")\
            if dictionary.get("postalCode")\
                else APIHelper.SKIP
        location =\
            dictionary.get("location")\
            if dictionary.get("location")\
                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(city,
                   state,
                   country,
                   location_id,
                   address_1,
                   postal_code,
                   location,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _city=(
            self.city
            if hasattr(self, "city")
            else None
        )
        _state=(
            self.state
            if hasattr(self, "state")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"city={_city!r}, "
            f"state={_state!r}, "
            f"country={_country!r}, "
            f"location_id={_location_id!r}, "
            f"address_1={_address_1!r}, "
            f"postal_code={_postal_code!r}, "
            f"location={_location!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _city=(
            self.city
            if hasattr(self, "city")
            else None
        )
        _state=(
            self.state
            if hasattr(self, "state")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _address_1=(
            self.address_1
            if hasattr(self, "address_1")
            else None
        )
        _postal_code=(
            self.postal_code
            if hasattr(self, "postal_code")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"city={_city!s}, "
            f"state={_state!s}, "
            f"country={_country!s}, "
            f"location_id={_location_id!s}, "
            f"address_1={_address_1!s}, "
            f"postal_code={_postal_code!s}, "
            f"location={_location!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
