"""cellpointapi.

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

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


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

    The travel airport details.

    Attributes:
        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
        name (str): The name of airport and terminal.
        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, JFK is the IATA code for, you might know it, New York's John
            F. Kennedy International Airport.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "country": "country",
        "name": "name",
        "iata_code": "iataCode",
    }

    def __init__(
        self,
        country=None,
        name=None,
        iata_code=None,
        additional_properties=None):
        """Initialize a Airport instance."""
        # Initialize members of the class
        self.country = country
        self.name = name
        self.iata_code = iata_code

        # 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
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else None
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else None
        iata_code =\
            dictionary.get("iataCode")\
            if dictionary.get("iataCode")\
                else None

        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(country,
                   name,
                   iata_code,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _country=self.country
        _name=self.name
        _iata_code=self.iata_code
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"country={_country!r}, "
            f"name={_name!r}, "
            f"iata_code={_iata_code!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _country=self.country
        _name=self.name
        _iata_code=self.iata_code
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"country={_country!s}, "
            f"name={_name!s}, "
            f"iata_code={_iata_code!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
