from flask import jsonify
from flask.views import View

from pycs.database.Database import Database


class ListModels(View):
    """
    get a list of all available models
    """
    # pylint: disable=arguments-differ
    methods = ['GET']

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

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