package net.tinsae;

import java.util.Scanner;
public class Main {

    public static void main(String[] args) {

        // host url
        String path = "http://localhost:8080/shop-1.0-SNAPSHOT/api";

        // table name
        String table = "/items";

        Delegator delegator = new Delegator(path, table);
        System.out.println("Hello! What do you want to do? allowed actions are \n"+
        "Insert, update, delete, read or exit to close");
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String response = sc.nextLine().strip();
            if(response.equalsIgnoreCase("exit") || response.equalsIgnoreCase("done")){
                
                break;
            }

            delegator.executeCommand(response);
            System.out.println("Continue with another command: ");

        }
        // we must close scanner. leaks happen in java too.
        sc.close();
        System.out.println("Program ended. \nDon't forget to close the server too. \n Good bye!!!");

    }
}