# -*- 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.queryextraparams import Queryextraparams


class NewQueryobject(object):

    """Implementation of the 'NewQueryobject' model.

    TODO: type model description here.

    Attributes:
        allowed_days (string): A string that represents specific days in a
            week, Sunday being 0 and Friday being 6. To select more than a
            specific day just concatenate the day number to the string
        allowed_run_time_end (string): TODO: type description here.
        allowed_run_time_start (string): TODO: type description here.
        end_time (string): TODO: type description here.
        start_time (string): TODO: type description here.
        attached_queries (list of int): TODO: type description here.
        enabled (bool): TODO: type description here.
        interval (string): TODO: type description here.
        is_recurring (bool): TODO: type description here.
        name (string): TODO: type description here.
        network_id (int): TODO: type description here.
        mtype (int): TODO: type description here.
        extra_params (Queryextraparams): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "allowed_days": 'allowed_days',
        "allowed_run_time_end": 'allowed_run_time_end',
        "allowed_run_time_start": 'allowed_run_time_start',
        "end_time": 'end_time',
        "start_time": 'start_time',
        "attached_queries": 'attached_queries',
        "enabled": 'enabled',
        "interval": 'interval',
        "is_recurring": 'is_recurring',
        "name": 'name',
        "network_id": 'network_id',
        "mtype": 'type',
        "extra_params": 'extra_params'
    }

    _optionals = [
        'allowed_days',
        'allowed_run_time_end',
        'allowed_run_time_start',
        'end_time',
        'start_time',
        'attached_queries',
        'enabled',
        'interval',
        'is_recurring',
        'name',
        'network_id',
        'mtype',
        'extra_params',
    ]

    def __init__(self,
                 allowed_days=APIHelper.SKIP,
                 allowed_run_time_end=APIHelper.SKIP,
                 allowed_run_time_start=APIHelper.SKIP,
                 end_time=APIHelper.SKIP,
                 start_time=APIHelper.SKIP,
                 attached_queries=APIHelper.SKIP,
                 enabled=APIHelper.SKIP,
                 interval=APIHelper.SKIP,
                 is_recurring=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 network_id=APIHelper.SKIP,
                 mtype=APIHelper.SKIP,
                 extra_params=APIHelper.SKIP):
        """Constructor for the NewQueryobject class"""

        # Initialize members of the class
        if allowed_days is not APIHelper.SKIP:
            self.allowed_days = allowed_days 
        if allowed_run_time_end is not APIHelper.SKIP:
            self.allowed_run_time_end = allowed_run_time_end 
        if allowed_run_time_start is not APIHelper.SKIP:
            self.allowed_run_time_start = allowed_run_time_start 
        if end_time is not APIHelper.SKIP:
            self.end_time = end_time 
        if start_time is not APIHelper.SKIP:
            self.start_time = start_time 
        if attached_queries is not APIHelper.SKIP:
            self.attached_queries = attached_queries 
        if enabled is not APIHelper.SKIP:
            self.enabled = enabled 
        if interval is not APIHelper.SKIP:
            self.interval = interval 
        if is_recurring is not APIHelper.SKIP:
            self.is_recurring = is_recurring 
        if name is not APIHelper.SKIP:
            self.name = name 
        if network_id is not APIHelper.SKIP:
            self.network_id = network_id 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 
        if extra_params is not APIHelper.SKIP:
            self.extra_params = extra_params 

    @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

        allowed_days = dictionary.get("allowed_days") if dictionary.get("allowed_days") else APIHelper.SKIP
        allowed_run_time_end = dictionary.get("allowed_run_time_end") if dictionary.get("allowed_run_time_end") else APIHelper.SKIP
        allowed_run_time_start = dictionary.get("allowed_run_time_start") if dictionary.get("allowed_run_time_start") else APIHelper.SKIP
        end_time = dictionary.get("end_time") if dictionary.get("end_time") else APIHelper.SKIP
        start_time = dictionary.get("start_time") if dictionary.get("start_time") else APIHelper.SKIP
        attached_queries = dictionary.get("attached_queries") if dictionary.get("attached_queries") else APIHelper.SKIP
        enabled = dictionary.get("enabled") if "enabled" in dictionary.keys() else APIHelper.SKIP
        interval = dictionary.get("interval") if dictionary.get("interval") else APIHelper.SKIP
        is_recurring = dictionary.get("is_recurring") if "is_recurring" in dictionary.keys() else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        network_id = dictionary.get("network_id") if dictionary.get("network_id") else APIHelper.SKIP
        mtype = dictionary.get("type") if dictionary.get("type") else APIHelper.SKIP
        extra_params = Queryextraparams.from_dictionary(dictionary.get('extra_params')) if 'extra_params' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(allowed_days,
                   allowed_run_time_end,
                   allowed_run_time_start,
                   end_time,
                   start_time,
                   attached_queries,
                   enabled,
                   interval,
                   is_recurring,
                   name,
                   network_id,
                   mtype,
                   extra_params)
