import quick.Interface;
import squirrel.Database;
import squirrel.ModelManager;
import interfaces.Index;
import interfaces.Login;
import java.sql.Connection;
import squirrel.LocalStorage;

public class Main {
    public static void main(String[] args) {
        ModelManager.initializeModels();
        Connection conn = Database.getConnection();
        Migration.run(conn);

        Interface app = new Interface(Login.class);
        app.registerView(Index.class);
        app.registerView(Login.class);

        class Point {
            public int x;
            public int y;
            public int z = 0;
            public String name = "origin";

            public Point(int x, int y) {
                this.x = x;
                this.y = y;
            }
        }

        Point p = new Point(3, 4);
        System.out.println("Point: (" + p.x + ", " + p.y + ", " + p.z + ", " + p.name + ")");

        LocalStorage storage = new LocalStorage();
        storage.save("point1", p);

        Point loaded = storage.load("point1", Point.class);
        System.out.println("Loaded Point: (" + loaded.x + ", " + loaded.y + ", " + loaded.z + ", " + loaded.name + ")");

        storage.flush();
    }
}
