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

"""
swaggerpetstoreopenapi30

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


class Pet(object):

    """Implementation of the 'Pet' model.

    Attributes:
        name (str): The model property of type str.
        photo_urls (List[str]): The model property of type List[str].
        id (int): The model property of type int.
        category (Category): The model property of type Category.
        tags (List[Tag]): The model property of type List[Tag].
        pet_status (PetStatusEnum): pet status in the store

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "photo_urls": 'photoUrls',
        "id": 'id',
        "category": 'category',
        "tags": 'tags',
        "pet_status": 'petStatus'
    }

    _optionals = [
        'id',
        'category',
        'tags',
        'pet_status',
    ]

    def __init__(self,
                 name=None,
                 photo_urls=None,
                 id=APIHelper.SKIP,
                 category=APIHelper.SKIP,
                 tags=APIHelper.SKIP,
                 pet_status=APIHelper.SKIP):
        """Constructor for the Pet class"""

        # Initialize members of the class
        self.name = name 
        self.photo_urls = photo_urls 
        if id is not APIHelper.SKIP:
            self.id = id 
        if category is not APIHelper.SKIP:
            self.category = category 
        if tags is not APIHelper.SKIP:
            self.tags = tags 
        if pet_status is not APIHelper.SKIP:
            self.pet_status = pet_status 

    @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
        name = dictionary.get("name") if dictionary.get("name") else None
        photo_urls = dictionary.get("photoUrls") if dictionary.get("photoUrls") else None
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        category = Category.from_dictionary(dictionary.get('category')) if 'category' in dictionary.keys() else APIHelper.SKIP
        tags = None
        if dictionary.get('tags') is not None:
            tags = [Tag.from_dictionary(x) for x in dictionary.get('tags')]
        else:
            tags = APIHelper.SKIP
        pet_status = dictionary.get("petStatus") if dictionary.get("petStatus") else APIHelper.SKIP
        # Return an object of this model
        return cls(name,
                   photo_urls,
                   id,
                   category,
                   tags,
                   pet_status)

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

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