import flask

from jjsystem.common.subsystem import controller
from jjsystem.common import exception


class Controller(controller.Controller):

    def __init__(self, manager, resource_wrap, collection_wrap):
        super(Controller, self).__init__(
            manager, resource_wrap, collection_wrap)

    def deletar_tokens(self):
        data = self._filters_parse()
        try:
            self.manager.deletar_tokens(**data)
        except exception.JJSystemException as exc:
            return flask.Response(response=exc.message,
                                  status=exc.status)

        return flask.Response(response=None,
                              status=204,
                              mimetype="application/json")
