package Repository;

import database.MongoDBConnector;
import objects.Solution;
import org.bson.Document;

/**
 * Created by gpietrus on 20.02.2016.
 */
public class SolutionsRepository implements Repository {

    private MongoDBConnector mongoDBConnector;

    public SolutionsRepository(MongoDBConnector mongoDBConnector) {
        this.mongoDBConnector = mongoDBConnector;
    }

//    public void get(UUID uuid) {
//
//    }

//    public List<Solution> getAll() {
//        return mongoDBConnector.getCollection("solutions")
//                .stream()
//                .map(Solution::new)
//                .collect(Collectors.toList());
//    }

    public void add(Solution solution) {
        mongoDBConnector.addDocument("solutions", new Document(solution.toMap()));
    }

    public void clean() {
        mongoDBConnector.removeCollection("solutions");
    }
}

//todo: generify!