# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class EditorConfigurationDetails(BaseModel):
# 
#     def __init__(
#             self,
#             uuid=None,
#             name=None,
#             title=None,
#             owner=None,
#             user_permissions=None,
#             is_was=None,
#             is_agent=None,
#             settings=None,
#             filter_attributes=None,
#     ):
#         self._filter_attributes = None
# 
#         self.uuid = uuid
#         self.name = name
#         self.title = title
#         self.owner = owner
#         self.user_permissions = user_permissions
#         self.is_was = is_was
#         self.is_agent = is_agent
#         self.settings = settings
#         self.filter_attributes = filter_attributes
# 
#     @property
#     def filter_attributes(self):
#         return self._filter_attributes
# 
#     @filter_attributes.setter
#     @BaseModel._model_list(EditorConfigurationFilterAttributes)
#     def filter_attributes(self, filter_attributes):
#         self._filter_attributes = filter_attributes
# 
# class EditorPluginDetails(BaseModel):
# 
#     def __init__(
#             self,
#             plugindescription=None
#     ):
#         self._plugindescription = None
# 
#         self.plugindescription = plugindescription
# 
#     @property
#     def plugindescription(self):
#         return self._plugindescription
# 
#     @plugindescription.setter
#     @BaseModel._model(EditorPluginDescription)
#     def plugindescription(self, plugindescription):
#         self._plugindescription = plugindescription
# 
# class EditorTemplateDetails(BaseModel):
# 
#     def __init__(
#             self,
#             uuid=None,
#             name=None,
#             title=None,
#             owner=None,
#             user_permissions=None,
#             is_was=None,
#             is_agent=None,
#             settings=None,
#             filter_attributes=None,
#     ):
#         self._filter_attributes = None
# 
#         self.uuid = uuid
#         self.name = name
#         self.title = title
#         self.owner = owner
#         self.user_permissions = user_permissions
#         self.is_was = is_was
#         self.is_agent = is_agent
#         self.settings = settings
#         self.filter_attributes = filter_attributes
# 
#     @property
#     def filter_attributes(self):
#         return self._filter_attributes
# 
#     @filter_attributes.setter
#     @BaseModel._model_list(EditorConfigurationFilterAttributes)
#     def filter_attributes(self, filter_attributes):
#         self._filter_attributes = filter_attributes
# 
# class TemplateList(BaseModel):
# 
#     def __init__(
#             self,
#             templates=None,
#     ):
#         self._templates = templates
# 
#         self.templates = templates
# 
#     @property
#     def templates(self):
#         return self._templates
# 
#     @templates.setter
#     @BaseModel._model_list(Template)
#     def templates(self, templates):
#         self._templates = templates


from tenable_io.api.base import BaseApi
from tenable_io.api.models import EditorConfigurationDetails, EditorPluginDetails, EditorTemplateDetails, TemplateList

SCAN = u'scan'
POLICY = u'policy'

class EditorApi(BaseApi):

    def list(self, type):
        """Returns the template list.

        :param type: The type of template (scan or policy).
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.TemplateList`.
        """
        response = self._client.get('editor/%(type)s/templates', path_params={'type': type})
        return TemplateList.from_json(response.text)


    def details(self, type, id):
        """
        Gets the configuration details for the scan or policy.
        :param type: Type of entity, must be `scan` or `policy`.
        :param id: numeric id of the object.
        :return: An instance of :class:`tenable_io.api.models.EditorConfigurationDetails`.
        """
        response = self._client.get('editor/%(type)s/%(id)s', path_params={'type': type, 'id': id})

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class EditorConfigurationDetails(BaseModel):
# 
#     def __init__(
#             self,
#             uuid=None,
#             name=None,
#             title=None,
#             owner=None,
#             user_permissions=None,
#             is_was=None,
#             is_agent=None,
#             settings=None,
#             filter_attributes=None,
#     ):
#         self._filter_attributes = None
# 
#         self.uuid = uuid
#         self.name = name
#         self.title = title
#         self.owner = owner
#         self.user_permissions = user_permissions
#         self.is_was = is_was
#         self.is_agent = is_agent
#         self.settings = settings
#         self.filter_attributes = filter_attributes
# 
#     @property
#     def filter_attributes(self):
#         return self._filter_attributes
# 
#     @filter_attributes.setter
#     @BaseModel._model_list(EditorConfigurationFilterAttributes)
#     def filter_attributes(self, filter_attributes):
#         self._filter_attributes = filter_attributes
# 
# class EditorPluginDetails(BaseModel):
# 
#     def __init__(
#             self,
#             plugindescription=None
#     ):
#         self._plugindescription = None
# 
#         self.plugindescription = plugindescription
# 
#     @property
#     def plugindescription(self):
#         return self._plugindescription
# 
#     @plugindescription.setter
#     @BaseModel._model(EditorPluginDescription)
#     def plugindescription(self, plugindescription):
#         self._plugindescription = plugindescription
# 
# class EditorTemplateDetails(BaseModel):
# 
#     def __init__(
#             self,
#             uuid=None,
#             name=None,
#             title=None,
#             owner=None,
#             user_permissions=None,
#             is_was=None,
#             is_agent=None,
#             settings=None,
#             filter_attributes=None,
#     ):
#         self._filter_attributes = None
# 
#         self.uuid = uuid
#         self.name = name
#         self.title = title
#         self.owner = owner
#         self.user_permissions = user_permissions
#         self.is_was = is_was
#         self.is_agent = is_agent
#         self.settings = settings
#         self.filter_attributes = filter_attributes
# 
#     @property
#     def filter_attributes(self):
#         return self._filter_attributes
# 
#     @filter_attributes.setter
#     @BaseModel._model_list(EditorConfigurationFilterAttributes)
#     def filter_attributes(self, filter_attributes):
#         self._filter_attributes = filter_attributes
# 
# class TemplateList(BaseModel):
# 
#     def __init__(
#             self,
#             templates=None,
#     ):
#         self._templates = templates
# 
#         self.templates = templates
# 
#     @property
#     def templates(self):
#         return self._templates
# 
#     @templates.setter
#     @BaseModel._model_list(Template)
#     def templates(self, templates):
#         self._templates = templates


# Path: tenable_io/api/editor.py
from tenable_io.api.base import BaseApi
from tenable_io.api.models import EditorConfigurationDetails, EditorPluginDetails, EditorTemplateDetails, TemplateList


SCAN = u'scan'
POLICY = u'policy'

class EditorApi(BaseApi):

    def list(self, type):
        """Returns the template list.

        :param type: The type of template (scan or policy).
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.TemplateList`.
        """
        response = self._client.get('editor/%(type)s/templates', path_params={'type': type})
        return TemplateList.from_json(response.text)


    def details(self, type, id):
        """
        Gets the configuration details for the scan or policy.
        :param type: Type of entity, must be `scan` or `policy`.
        :param id: numeric id of the object.
        :return: An instance of :class:`tenable_io.api.models.EditorConfigurationDetails`.
        """
        response = self._client.get('editor/%(type)s/%(id)s', path_params={'type': type, 'id': id})

        return EditorConfigurationDetails.from_json(response.text)