package cz.muni.fi.lasaris.sbms.data.providers;

import java.util.List;
import java.util.Map;
import java.util.Properties;

import cz.muni.fi.lasaris.sbms.data.entities.Address;
import cz.muni.fi.lasaris.sbms.data.entities.AddressGroup;
import cz.muni.fi.lasaris.sbms.data.entities.AggregationFunction;
import cz.muni.fi.lasaris.sbms.data.entities.containers.Aggregation;
import cz.muni.fi.lasaris.sbms.data.entities.containers.Snapshot;
import cz.muni.fi.lasaris.sbms.data.entities.values.AggregatedValue;
import cz.muni.fi.lasaris.sbms.data.entities.values.RawValue;

public interface DataPointsProvider {
	
	void init(Properties props, String name, String propertiesPrefix);
	void close();
	
	RawValue getDataPointValue(Address dataPoint, boolean allowCache);
	Snapshot getDataPointValues(List<Address> dataPoints, boolean allowCache);
	
	Map<String, Snapshot> getDataPointGroupedValues(Map<String, List<Address>> dataPointGroups, boolean allowCache);
	
	// compute aggregation over group of data points
	AggregatedValue getDataPointsAggregation(List<Address> dataPoints, AggregationFunction aggregation, boolean allowCache);
	
	// compute aggregations for each group of data points (equivalent to repeated call to getDataPointsAggregation)
	Aggregation<AddressGroup> getDataPointGroupAggregations(Map<String,List<Address>> dataPointGroups, AggregationFunction aggregation, boolean allowCache);
}
