package su.xserver.iikocon.iiko;

import io.vertx.core.Vertx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {
  private static final Logger log = LoggerFactory.getLogger(Main.class);

  public static void main(String[] args) {
    long time = System.currentTimeMillis();

    Vertx vertx = Vertx.vertx();

    IikoOlapColumnsImporter importer = new IikoOlapColumnsImporter(
      vertx,
      "folk-amber-co.iiko.it",    // без https://
      "4444",
      "92f2fd99879b0c2466ab8648afb63c49032379c1",
      "phpmyadmin.xserver.su",                // хост MariaDB
      3306,
      "test",            // имя БД
      "test",
      "test"
    );



    importer.fetchAndStoreAll()
      .onComplete(ar -> {
        if (ar.succeeded()) {
          System.out.println("Import completed successfully.");
          log.info("time to sc: {}", (System.currentTimeMillis() - time) + "ms");

        } else {
          System.err.println("Import failed: " + ar.cause().getMessage());
        }
//        importer.close();
//        vertx.close();
      });

  }
}
