"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper


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

    Location of Rental company.

    Attributes:
        location (str): Name of rental company location.
        is_airport (bool): Indicates if the location is an airport.
        airport_iata_code (str): The International Air Transport Association's (IATA)
            Location Identifier is a unique 3-letter code (also commonly known as
            IATA code) used in aviation and also in logistics to identify an airport.
            For example, ORD is the IATA code for, you might know it, Chicago's
            O'Hare International Airport.
        street_address_1 (str): The street address. For example, 1600 Amphitheatre
            Pkwy.
        street_address_2 (str): Additional information about the address, such as
            floor or apartment number.
        office_box_number (str): The post office box number for PO box addresses.
        locality (str): The locality in which the street address is, and which is in
            the region.   This is often the "City", for example: "Mountain View".
        region (str): The region in which the locality is in, and which is in the
            country.   For US addresses this must be the state abbreviation
            consisting of two uppercase letters.   For example, "CA" for California
            or another appropriate first-level Administrative division.
        postal_code (str): The postal code. For example, 94043.
        country (str): Country code based on ISO 3166-1 alpha-2 standard.  Countries
            codes must be UPPERCASE.  E.g. <table>   <thead>     <tr>
            <th>Alpha-2 Code</th>       <th>Country</th>     </tr>   </thead>
            <tbody>     <tr>       <td>US</td>       <td>United States of
            America</td>     </tr>     <tr>       <td>CN</td>       <td>China</td>
            </tr>     <tr>       <td>JP</td>       <td>Japan</td>     </tr>     <tr>
            <td>DE</td>       <td>Germany</td>     </tr>     <tr>       <td>GB</td>
            <td>United Kingdom</td>     </tr>     <tr>       <td>IN</td>
            <td>India</td>     </tr>     <tr>       <td>FR</td>       <td>France</td>
            </tr>     <tr>       <td>IT</td>       <td>Italy</td>     </tr>     <tr>
            <td>CA</td>       <td>Canada</td>     </tr>   </tbody> </table>  Full
            list: https://www.iso.org/obp/ui
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "location": "location",
        "is_airport": "isAirport",
        "street_address_1": "streetAddress1",
        "postal_code": "postalCode",
        "country": "country",
        "airport_iata_code": "airportIataCode",
        "street_address_2": "streetAddress2",
        "office_box_number": "officeBoxNumber",
        "locality": "locality",
        "region": "region",
    }

    _optionals = [
        "airport_iata_code",
        "street_address_2",
        "office_box_number",
        "locality",
        "region",
    ]

    def __init__(
        self,
        location=None,
        is_airport=None,
        street_address_1=None,
        postal_code=None,
        country=None,
        airport_iata_code=APIHelper.SKIP,
        street_address_2=APIHelper.SKIP,
        office_box_number=APIHelper.SKIP,
        locality=APIHelper.SKIP,
        region=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a RentalLocation instance."""
        # Initialize members of the class
        self.location = location
        self.is_airport = is_airport
        if airport_iata_code is not APIHelper.SKIP:
            self.airport_iata_code = airport_iata_code
        self.street_address_1 = street_address_1
        if street_address_2 is not APIHelper.SKIP:
            self.street_address_2 = street_address_2
        if office_box_number is not APIHelper.SKIP:
            self.office_box_number = office_box_number
        if locality is not APIHelper.SKIP:
            self.locality = locality
        if region is not APIHelper.SKIP:
            self.region = region
        self.postal_code = postal_code
        self.country = country

        # 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
        location =\
            dictionary.get("location")\
            if dictionary.get("location")\
                else None
        is_airport =\
            dictionary.get("isAirport")\
            if "isAirport" in dictionary.keys()\
                else None
        street_address_1 =\
            dictionary.get("streetAddress1")\
            if dictionary.get("streetAddress1")\
                else None
        postal_code =\
            dictionary.get("postalCode")\
            if dictionary.get("postalCode")\
                else None
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else None
        airport_iata_code =\
            dictionary.get("airportIataCode")\
            if dictionary.get("airportIataCode")\
                else APIHelper.SKIP
        street_address_2 =\
            dictionary.get("streetAddress2")\
            if dictionary.get("streetAddress2")\
                else APIHelper.SKIP
        office_box_number =\
            dictionary.get("officeBoxNumber")\
            if dictionary.get("officeBoxNumber")\
                else APIHelper.SKIP
        locality =\
            dictionary.get("locality")\
            if dictionary.get("locality")\
                else APIHelper.SKIP
        region =\
            dictionary.get("region")\
            if dictionary.get("region")\
                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(location,
                   is_airport,
                   street_address_1,
                   postal_code,
                   country,
                   airport_iata_code,
                   street_address_2,
                   office_box_number,
                   locality,
                   region,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _location=self.location
        _is_airport=self.is_airport
        _airport_iata_code=(
            self.airport_iata_code
            if hasattr(self, "airport_iata_code")
            else None
        )
        _street_address_1=self.street_address_1
        _street_address_2=(
            self.street_address_2
            if hasattr(self, "street_address_2")
            else None
        )
        _office_box_number=(
            self.office_box_number
            if hasattr(self, "office_box_number")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _region=(
            self.region
            if hasattr(self, "region")
            else None
        )
        _postal_code=self.postal_code
        _country=self.country
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"location={_location!r}, "
            f"is_airport={_is_airport!r}, "
            f"airport_iata_code={_airport_iata_code!r}, "
            f"street_address_1={_street_address_1!r}, "
            f"street_address_2={_street_address_2!r}, "
            f"office_box_number={_office_box_number!r}, "
            f"locality={_locality!r}, "
            f"region={_region!r}, "
            f"postal_code={_postal_code!r}, "
            f"country={_country!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _location=self.location
        _is_airport=self.is_airport
        _airport_iata_code=(
            self.airport_iata_code
            if hasattr(self, "airport_iata_code")
            else None
        )
        _street_address_1=self.street_address_1
        _street_address_2=(
            self.street_address_2
            if hasattr(self, "street_address_2")
            else None
        )
        _office_box_number=(
            self.office_box_number
            if hasattr(self, "office_box_number")
            else None
        )
        _locality=(
            self.locality
            if hasattr(self, "locality")
            else None
        )
        _region=(
            self.region
            if hasattr(self, "region")
            else None
        )
        _postal_code=self.postal_code
        _country=self.country
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"location={_location!s}, "
            f"is_airport={_is_airport!s}, "
            f"airport_iata_code={_airport_iata_code!s}, "
            f"street_address_1={_street_address_1!s}, "
            f"street_address_2={_street_address_2!s}, "
            f"office_box_number={_office_box_number!s}, "
            f"locality={_locality!s}, "
            f"region={_region!s}, "
            f"postal_code={_postal_code!s}, "
            f"country={_country!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
