

import java.time.LocalDate;
import java.time.temporal.IsoFields;

import lib.SQLConnection;
import storagesim.Simulation;

/**
 * Holds the main function
 */
public class Main {

	/**
	 * Invokes the window
	 * 
	 * @param args program arguments
	 */
	public static void main(String[] args) {
		/*
		EventQueue.invokeLater(new Runnable() {
			@Override
			public void run() {
				try {
					StorageWindow w = new StorageWindow();
					w.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});*/
		//new Simulation().run();
		/*
TRUNCATE t_bestellungen;
TRUNCATE t_lager;
TRUNCATE t_mindesthaltbarkeit;
TRUNCATE t_statistik;
TRUNCATE t_verkaufszahlen;
		 */
		
		Simulation s = new Simulation();
		s.currentTime = LocalDate.parse("2018-01-01");
		SQLConnection db = new SQLConnection();
		while (s.currentTime.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR) <= 48) {
			System.out.println("Woche: " + s.currentTime.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR));
			//s.simulateSales(db);
			s.run(s.currentTime);
			s.currentTime = s.currentTime.plusDays(7);
		}
		//s.sortStatistics(db);
	}
}
