from flask import jsonify
from flask.views import View

from pycs.database.Database import Database


class ListLabelProviders(View):
    """
    returns a list of all available label providers
    """
    # pylint: disable=arguments-differ
    methods = ['GET']

    def __init__(self, db: Database):
        # pylint: disable=invalid-name
        self.db = db

    def dispatch_request(self):
        label_providers = list(self.db.label_providers())
        return jsonify(label_providers)
