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

"""
    ontraportlib.models.criteria
 
    This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) on 11/14/2017
"""
import  ontraportlib.models.base_model

class Criteria(ontraportlib.models.base_model.BaseModel):

    """Implementation of the 'Criteria' model.

    TODO: type model description here.

    Attributes:
        object_id (int): TODO: type description here.
        condition (string): Apply this condition to the collection query. This
            is essentially like a SQL WHERE clause, e.g. firstname='Ben'
        date_range (list of int): Start and End dates to search, in seconds
            since Jan 1, 1970, as a comma-separated list. Start (index 0 in
            the array) is inclusive, End (index 1) is exclusive. Either or
            both can be empty.
        externs (string): External fields to include in results
        group_ids (list of int): Array of Group ID for Object type as
            comma-delimited list
        ids (list of int): TODO: type description here.
        list_fields (list of string): Return only these fields in the
            response
        perform_all (bool): Perform request on all Objects that match
            criteria.
        range (int): Number of results to return (maximum=50)
        search (string): Search Objects for this string
        search_notes (string): Boolean flag to additionally search Object
            Notes for the Search term given in Search parameter
        sort (string): Field used to sort results
        sort_dir (SortDirEnum): Sort direction, must be used in conjunction
            with <b>sort</b> parameter.
        start (int): Return results starting at this offset

    """

    def __init__(self, 
                 object_id = None,
                 condition = None,
                 date_range = None,
                 externs = None,
                 group_ids = None,
                 ids = None,
                 list_fields = None,
                 perform_all = False,
                 range = None,
                 search = None,
                 search_notes = None,
                 sort = None,
                 sort_dir = None,
                 start = None):
        """Constructor for the Criteria class"""
        
        # Initialize members of the class
        self.object_id = object_id
        self.condition = condition
        self.date_range = date_range
        self.externs = externs
        self.group_ids = group_ids
        self.ids = ids
        self.list_fields = list_fields
        self.perform_all = perform_all
        self.range = range
        self.search = search
        self.search_notes = search_notes
        self.sort = sort
        self.sort_dir = sort_dir
        self.start = start

        # Create a mapping from Model property names to API property names
        self.names = {
            "object_id" : "objectID",
            "condition" : "condition",
            "date_range" : "date_range",
            "externs" : "externs",
            "group_ids" : "group_ids",
            "ids" : "ids",
            "list_fields" : "listFields",
            "perform_all" : "performAll",
            "range" : "range",
            "search" : "search",
            "search_notes" : "searchNotes",
            "sort" : "sort",
            "sort_dir" : "sortDir",
            "start" : "start",
        }


    @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 == None:
            return None
        else:
            # Extract variables from the dictionary
            object_id = dictionary.get("objectID")
            condition = dictionary.get("condition")
            date_range = dictionary.get("date_range")
            externs = dictionary.get("externs")
            group_ids = dictionary.get("group_ids")
            ids = dictionary.get("ids")
            list_fields = dictionary.get("listFields")
            perform_all = dictionary.get("performAll") if dictionary.get("performAll") else False
            range = dictionary.get("range")
            search = dictionary.get("search")
            search_notes = dictionary.get("searchNotes")
            sort = dictionary.get("sort")
            sort_dir = dictionary.get("sortDir")
            start = dictionary.get("start")
            # Return an object of this model
            return cls(object_id,
                       condition,
                       date_range,
                       externs,
                       group_ids,
                       ids,
                       list_fields,
                       perform_all,
                       range,
                       search,
                       search_notes,
                       sort,
                       sort_dir,
                       start)
