# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class ScReport(BaseModel):
#     def __init__(
#             self,
#             id=None,
#             image_name=None,
#             docker_image_id=None,
#             tag=None,
#             os=None,
#             os_version=None,
#             os_architecture=None,
#             sha256=None,
#             sha1=None,
#             md5=None,
#             platform=None,
#             created_at=None,
#             updated_at=None,
#             malware=None,
#             findings=None,
#             installed_packages=None,
#             risk_score=None,
#             digest=None,
#     ):
#         self.id = id
#         self.image_name = image_name
#         self.docker_image_id = docker_image_id
#         self.tag = tag
#         self.os = os
#         self.os_version = os_version
#         self.os_architecture = os_architecture
#         self.sha256 = sha256
#         self.sha1 = sha1
#         self.md5 = md5
#         self.platform = platform
#         self.created_at = created_at
#         self.updated_at = updated_at
#         self.malware = malware
#         self.findings = findings
#         self.installed_packages = installed_packages
#         self.risk_score = risk_score
#         self.digest = digest


from tenable_io.api.base import BaseApi
from tenable_io.api.models import ScReport


class ScReportsApi(BaseApi):

    def show(self, container_id):
        """Get JSON format report using container ID.

        :param container_id: The ID of the container image.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class`tenable_io.api.models.ScReport`.
        """
        response = self._client.get('container-security/api/v1/reports/show', params={'container_id': container_id})
        return ScReport.from_json(response.text)

    def by_image(self, image_id):
        """Get JSON format report using docker ID.

        :param image_id: The ID of the docker image.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class`tenable_io.api.models.ScReport`.
        """
        response = self._client.get('container-security/api/v1/reports/by_image', params={'image_id': image_id})

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/models.py
# class ScReport(BaseModel):
#     def __init__(
#             self,
#             id=None,
#             image_name=None,
#             docker_image_id=None,
#             tag=None,
#             os=None,
#             os_version=None,
#             os_architecture=None,
#             sha256=None,
#             sha1=None,
#             md5=None,
#             platform=None,
#             created_at=None,
#             updated_at=None,
#             malware=None,
#             findings=None,
#             installed_packages=None,
#             risk_score=None,
#             digest=None,
#     ):
#         self.id = id
#         self.image_name = image_name
#         self.docker_image_id = docker_image_id
#         self.tag = tag
#         self.os = os
#         self.os_version = os_version
#         self.os_architecture = os_architecture
#         self.sha256 = sha256
#         self.sha1 = sha1
#         self.md5 = md5
#         self.platform = platform
#         self.created_at = created_at
#         self.updated_at = updated_at
#         self.malware = malware
#         self.findings = findings
#         self.installed_packages = installed_packages
#         self.risk_score = risk_score
#         self.digest = digest


# Path: tenable_io/api/sc_reports.py
from tenable_io.api.base import BaseApi
from tenable_io.api.models import ScReport



class ScReportsApi(BaseApi):

    def show(self, container_id):
        """Get JSON format report using container ID.

        :param container_id: The ID of the container image.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class`tenable_io.api.models.ScReport`.
        """
        response = self._client.get('container-security/api/v1/reports/show', params={'container_id': container_id})
        return ScReport.from_json(response.text)

    def by_image(self, image_id):
        """Get JSON format report using docker ID.

        :param image_id: The ID of the docker image.
        :raise TenableIOApiException:  When API error is encountered.
        :return: An instance of :class`tenable_io.api.models.ScReport`.
        """
        response = self._client.get('container-security/api/v1/reports/by_image', params={'image_id': image_id})

        return ScReport.from_json(response.text)