# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class PluginDetails(BaseModel):
# 
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             family_name=None,
#             attributes=None
#     ):
#         self._attributes = None
#         self.id = id
#         self.name = name
#         self.family_name = family_name
#         self.attributes = attributes
# 
#     @property
#     def attributes(self):
#         return self._attributes
# 
#     @attributes.setter
#     @BaseModel._model_list(PluginAttribute)
#     def attributes(self, attributes):
#         self._attributes = attributes
# 
# class PluginFamilyDetails(BaseModel):
# 
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             plugins=None
#     ):
#         self._plugins = None
#         self.id = id
#         self.name = name
#         self.plugins = plugins
# 
#     @property
#     def plugins(self):
#         return self._plugins
# 
#     @plugins.setter
#     @BaseModel._model_list(Plugin)
#     def plugins(self, plugins):
#         self._plugins = plugins
# 
# class PluginFamilyList(BaseModel):
# 
#     def __init__(
#             self,
#             families=None
#     ):
#         self._families = None
#         self.families = families
# 
#     @property
#     def families(self):
#         return self._families
# 
#     @families.setter
#     @BaseModel._model_list(PluginFamily)
#     def families(self, families):
#         self._families = families


from tenable_io.api.base import BaseApi
from tenable_io.api.models import PluginDetails, PluginFamilyDetails, PluginFamilyList


class PluginsApi(BaseApi):

    def families(self, include_all=None):
        """Return list of plugin families.

        :param include_all: Whether or not to include all plugins. Defaults to be less inclusive.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.PluginFamilyList`.
        """
        params = {'all': include_all}
        response = self._client.get('plugins/families', params={k: v for (k, v) in params.items() if v})
        return PluginFamilyList.from_json(response.text)

    def family_details(self, family_id):
        """Return plugin family details.

        :param family_id: Plugin family ID.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.PluginFamilyDetails`.
        """
        response = self._client.get('plugins/families/%(id)s', path_params={'id': family_id})

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class PluginDetails(BaseModel):
# 
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             family_name=None,
#             attributes=None
#     ):
#         self._attributes = None
#         self.id = id
#         self.name = name
#         self.family_name = family_name
#         self.attributes = attributes
# 
#     @property
#     def attributes(self):
#         return self._attributes
# 
#     @attributes.setter
#     @BaseModel._model_list(PluginAttribute)
#     def attributes(self, attributes):
#         self._attributes = attributes
# 
# class PluginFamilyDetails(BaseModel):
# 
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             plugins=None
#     ):
#         self._plugins = None
#         self.id = id
#         self.name = name
#         self.plugins = plugins
# 
#     @property
#     def plugins(self):
#         return self._plugins
# 
#     @plugins.setter
#     @BaseModel._model_list(Plugin)
#     def plugins(self, plugins):
#         self._plugins = plugins
# 
# class PluginFamilyList(BaseModel):
# 
#     def __init__(
#             self,
#             families=None
#     ):
#         self._families = None
#         self.families = families
# 
#     @property
#     def families(self):
#         return self._families
# 
#     @families.setter
#     @BaseModel._model_list(PluginFamily)
#     def families(self, families):
#         self._families = families


# Path: tenable_io/api/plugins.py
from tenable_io.api.base import BaseApi
from tenable_io.api.models import PluginDetails, PluginFamilyDetails, PluginFamilyList



class PluginsApi(BaseApi):

    def families(self, include_all=None):
        """Return list of plugin families.

        :param include_all: Whether or not to include all plugins. Defaults to be less inclusive.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.PluginFamilyList`.
        """
        params = {'all': include_all}
        response = self._client.get('plugins/families', params={k: v for (k, v) in params.items() if v})
        return PluginFamilyList.from_json(response.text)

    def family_details(self, family_id):
        """Return plugin family details.

        :param family_id: Plugin family ID.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class:`tenable_io.api.models.PluginFamilyDetails`.
        """
        response = self._client.get('plugins/families/%(id)s', path_params={'id': family_id})

        return PluginFamilyDetails.from_json(response.text)