from flask import request, Response
from db.repository import Repository
from db.entities import ClusterSet

repo = Repository()

def get():
    return [c.to_serializable_dict() for c in repo.get_clustersets()]

def get_names():
    return repo.get_clusterset_names()

def get_by_name(name):
    res = repo.get_clusterset(name)
    if res is not None:
        return res.to_serializable_dict() 
    else:
        return Response(status=404)