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

"""
ctddocumentation

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


class AssetsWithInsightsResponse(object):

    """Implementation of the 'AssetsWithInsightsResponse' model.

    TODO: type model description here.

    Attributes:
        count_filtered (int): TODO: type description here.
        count_in_page (int): TODO: type description here.
        count_total (int): TODO: type description here.
        objects (list of AssetsWithInsights): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "count_filtered": 'count_filtered',
        "count_in_page": 'count_in_page',
        "count_total": 'count_total',
        "objects": 'objects'
    }

    _optionals = [
        'count_filtered',
        'count_in_page',
        'count_total',
        'objects',
    ]

    def __init__(self,
                 count_filtered=APIHelper.SKIP,
                 count_in_page=APIHelper.SKIP,
                 count_total=APIHelper.SKIP,
                 objects=APIHelper.SKIP):
        """Constructor for the AssetsWithInsightsResponse class"""

        # Initialize members of the class
        if count_filtered is not APIHelper.SKIP:
            self.count_filtered = count_filtered 
        if count_in_page is not APIHelper.SKIP:
            self.count_in_page = count_in_page 
        if count_total is not APIHelper.SKIP:
            self.count_total = count_total 
        if objects is not APIHelper.SKIP:
            self.objects = objects 

    @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

        count_filtered = dictionary.get("count_filtered") if dictionary.get("count_filtered") else APIHelper.SKIP
        count_in_page = dictionary.get("count_in_page") if dictionary.get("count_in_page") else APIHelper.SKIP
        count_total = dictionary.get("count_total") if dictionary.get("count_total") else APIHelper.SKIP
        objects = None
        if dictionary.get('objects') is not None:
            objects = [AssetsWithInsights.from_dictionary(x) for x in dictionary.get('objects')]
        else:
            objects = APIHelper.SKIP
        # Return an object of this model
        return cls(count_filtered,
                   count_in_page,
                   count_total,
                   objects)
