# -*- coding: utf-8 -*-

"""
instagramapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from instagramapi.api_helper import APIHelper


class LocationInfo(object):

    """Implementation of the 'LocationInfo' model.

    Attributes:
        id (str): ID of this location (in some responses it has a type of
            'integer')
        latitude (float): Location latitude
        longitude (float): Location longitude
        name (str): Location name

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'id',
        "latitude": 'latitude',
        "longitude": 'longitude',
        "name": 'name'
    }

    _optionals = [
        'id',
        'latitude',
        'longitude',
        'name',
    ]

    def __init__(self,
                 id=APIHelper.SKIP,
                 latitude=APIHelper.SKIP,
                 longitude=APIHelper.SKIP,
                 name=APIHelper.SKIP):
        """Constructor for the LocationInfo class"""

        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id 
        if latitude is not APIHelper.SKIP:
            self.latitude = latitude 
        if longitude is not APIHelper.SKIP:
            self.longitude = longitude 
        if name is not APIHelper.SKIP:
            self.name = name 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        latitude = dictionary.get("latitude") if dictionary.get("latitude") else APIHelper.SKIP
        longitude = dictionary.get("longitude") if dictionary.get("longitude") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        # Return an object of this model
        return cls(id,
                   latitude,
                   longitude,
                   name)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'latitude={(self.latitude if hasattr(self, "latitude") else None)!r}, '
                f'longitude={(self.longitude if hasattr(self, "longitude") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'latitude={(self.latitude if hasattr(self, "latitude") else None)!s}, '
                f'longitude={(self.longitude if hasattr(self, "longitude") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s})')
