package cz.muni.fi.lasaris.sbms.data.api.response;

import java.util.LinkedHashMap;
import java.util.Map;

import cz.muni.fi.lasaris.sbms.data.entities.containers.Series;
import cz.muni.fi.lasaris.sbms.data.entities.values.Value;

public class SeriesOfValuesResponse {
	
	private static final String DEFAULT_GROUPING = "noGrouping";
	
	private String error;
	private Map<String, Series<? extends Value>> results;
	
	public Map<String, Series<? extends Value>> getResults() {
		return this.results;
	}
	
	public static SeriesOfValuesResponse getErrorResponse(String error) {
		SeriesOfValuesResponse r = new SeriesOfValuesResponse();
		r.setError(error);
		return r;
	}
	
	private SeriesOfValuesResponse() {
		this.results = null;
	}
	
	public SeriesOfValuesResponse(Map<String, Series<? extends Value>> data) {
		this.results = data;
	}
	
	
	public SeriesOfValuesResponse(Series<? extends Value> data) {
		this.results = new LinkedHashMap<String, Series<? extends Value>>();
		this.results.put(DEFAULT_GROUPING, data);
	}
	
	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}
	
}
