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

"""
    greenbyteapi

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

import greenbyteapi.models.metadata_field

class SiteWithData(object):

    """Implementation of the 'SiteWithData' model.

    TODO: type model description here.

    Attributes:
        site_id (int): The id of a site.
        title (string): TODO: type description here.
        country (string): TODO: type description here.
        identity (string): TODO: type description here.
        metadata (list of MetadataField): A list of metadata fields and their
            values.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "site_id":'siteId',
        "title":'title',
        "country":'country',
        "identity":'identity',
        "metadata":'metadata'
    }

    def __init__(self,
                 site_id=None,
                 title=None,
                 country=None,
                 identity=None,
                 metadata=None):
        """Constructor for the SiteWithData class"""

        # Initialize members of the class
        self.site_id = site_id
        self.title = title
        self.country = country
        self.identity = identity
        self.metadata = metadata


    @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 dictionary is None:
            return None

        # Extract variables from the dictionary
        site_id = dictionary.get('siteId')
        title = dictionary.get('title')
        country = dictionary.get('country')
        identity = dictionary.get('identity')
        metadata = None
        if dictionary.get('metadata') != None:
            metadata = list()
            for structure in dictionary.get('metadata'):
                metadata.append(greenbyteapi.models.metadata_field.MetadataField.from_dictionary(structure))

        # Return an object of this model
        return cls(site_id,
                   title,
                   country,
                   identity,
                   metadata)


