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

public enum AggregationWindow {
	NONE,
	DAY,
	HOUR,
	WEEK,
	MONTH,
	YEAR;
	
	public static AggregationWindow fromString(String s) {
		s = s.toUpperCase().trim();
		if(s.equals("DAY")) {
			return AggregationWindow.DAY;
		}
		if(s.equals("HOUR")) {
			return AggregationWindow.HOUR;
		}
		if(s.equals("WEEK")) {
			return AggregationWindow.WEEK;
		}
		if(s.equals("MONTH")) {
			return AggregationWindow.MONTH;
		}
		if(s.equals("YEAR")) {
			return AggregationWindow.YEAR;
		}
		if(s.equals("NONE")) {
			return AggregationWindow.NONE;
		}
		
		
		throw new IllegalArgumentException("Unknown window type.");
	}
}
