"""visaacceptancemergedspec.

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

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


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

    Attributes:
        city (str): City in which the auto was rented.  For authorizations, this
            field is supported for Visa, MasterCard, and American Express.  For
            captures, this field is supported only for American Express.  For all
            other card types, this field is ignored.
        state (str): State in which the auto was rented. Use the [State, Province,
            and Territory Codes for the United States and Canada](
        country (str): Country where the auto was rented. Use the [ISO Standard
            Country Codes.]( This field is supported only for American Express.
        location_id (str): The agency code, address, phone number, etc., used to
            identify the location where the vehicle was rented.
        address_1 (str): Address from where the vehicle was rented.
        address_2 (str): Address from where the vehicle was rented.
        postal_code (str): When merchant wants to send the rental address's postal
            code.
        location (str): This field contains the location where a taxi passenger was
            picked up or where an auto rental vehicle was picked up. In most cases,
            this is the rental agency's business name that appears on the storefront
            and/or customer receipts, commonly referred to as the DBA (Doing Business
            As) name. However, if the vehicle was picked up at another location
            (e.g., a hotel,auto dealership, repair shop, etc.), the name of that
            location should be used. This entry must be easily recognized by the
            Cardmember to avoid unnecessary inquiries. If the name is more than 38
            characters, use proper and meaningful abbreviation, when possible.
        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",
        "address_2": "address2",
        "postal_code": "postalCode",
        "location": "location",
    }

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

    def __init__(
        self,
        city=APIHelper.SKIP,
        state=APIHelper.SKIP,
        country=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        address_1=APIHelper.SKIP,
        address_2=APIHelper.SKIP,
        postal_code=APIHelper.SKIP,
        location=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RentalAddress 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 address_2 is not APIHelper.SKIP:
            self.address_2 = address_2
        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
        address_2 =\
            dictionary.get("address2")\
            if dictionary.get("address2")\
                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,
                   address_2,
                   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
        )
        _address_2=(
            self.address_2
            if hasattr(self, "address_2")
            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"address_2={_address_2!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
        )
        _address_2=(
            self.address_2
            if hasattr(self, "address_2")
            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"address_2={_address_2!s}, "
            f"postal_code={_postal_code!s}, "
            f"location={_location!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
