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

"""
swaggerpetstoreopenapi30

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


class Address(object):

    """Implementation of the 'Address' model.

    Attributes:
        street (str): The model property of type str.
        city (str): The model property of type str.
        state (str): The model property of type str.
        zip (str): The model property of type str.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "street": 'street',
        "city": 'city',
        "state": 'state',
        "zip": 'zip'
    }

    _optionals = [
        'street',
        'city',
        'state',
        'zip',
    ]

    def __init__(self,
                 street=APIHelper.SKIP,
                 city=APIHelper.SKIP,
                 state=APIHelper.SKIP,
                 zip=APIHelper.SKIP):
        """Constructor for the Address class"""

        # Initialize members of the class
        if street is not APIHelper.SKIP:
            self.street = street 
        if city is not APIHelper.SKIP:
            self.city = city 
        if state is not APIHelper.SKIP:
            self.state = state 
        if zip is not APIHelper.SKIP:
            self.zip = zip 

    @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
        street = dictionary.get("street") if dictionary.get("street") else APIHelper.SKIP
        city = dictionary.get("city") if dictionary.get("city") else APIHelper.SKIP
        state = dictionary.get("state") if dictionary.get("state") else APIHelper.SKIP
        zip = dictionary.get("zip") if dictionary.get("zip") else APIHelper.SKIP
        # Return an object of this model
        return cls(street,
                   city,
                   state,
                   zip)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'street={(self.street if hasattr(self, "street") else None)!r}, '
                f'city={(self.city if hasattr(self, "city") else None)!r}, '
                f'state={(self.state if hasattr(self, "state") else None)!r}, '
                f'zip={(self.zip if hasattr(self, "zip") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'street={(self.street if hasattr(self, "street") else None)!s}, '
                f'city={(self.city if hasattr(self, "city") else None)!s}, '
                f'state={(self.state if hasattr(self, "state") else None)!s}, '
                f'zip={(self.zip if hasattr(self, "zip") else None)!s})')
