# Path: looksee/queues.py
# class MasscanQueue(LookseeQueue):
#     """ Masscan parameter queue """
#     name = 'masscan'
# 
#     def serialize(self, value):
#         return json.dumps(map(str, value))
# 
#     def deserialize(self, value):
#         if value:
#             return MasscanJob(*json.loads(value))


from horizon import tables
from looksee.queues import MasscanQueue



class CreateScan(tables.LinkAction):
    name = 'create'
    verbose_name = 'New Scan'
    url = 'horizon:tasks:portscan:create'
    classes = ('ajax-modal', 'btn-create')


class DeleteScan(tables.Action):
    name = 'delete'
    verbose_name = 'Delete Task'
    data_type_singular = 'Queue'
    action_present = "delete"
    requires_input = False
    preempt = True
    classes = ("btn-danger", "btn-delete")

    def handle(self, data_table, request, object_ids):

# Path: looksee/queues.py
# class MasscanQueue(LookseeQueue):
#     """ Masscan parameter queue """
#     name = 'masscan'
# 
#     def serialize(self, value):
#         return json.dumps(map(str, value))
# 
#     def deserialize(self, value):
#         if value:
#             return MasscanJob(*json.loads(value))


# Path: caravan/caravan/dashboards/tasks/portscan/tables.py
from horizon import tables
from looksee.queues import MasscanQueue




class CreateScan(tables.LinkAction):
    name = 'create'
    verbose_name = 'New Scan'
    url = 'horizon:tasks:portscan:create'
    classes = ('ajax-modal', 'btn-create')


class DeleteScan(tables.Action):
    name = 'delete'
    verbose_name = 'Delete Task'
    data_type_singular = 'Queue'
    action_present = "delete"
    requires_input = False
    preempt = True
    classes = ("btn-danger", "btn-delete")

    def handle(self, data_table, request, object_ids):

        MasscanQueue().clear()