package main.java.ui;
import java.io.IOException;

public class MainMenu {
    String mainMenuStr =
        "SELECT AN OBJECT TO MANIPULATE:\n" +
        "1: Movie\n" +
        "2: Genre\n" +
        "3. Customer\n" +
        "4. Voucher\n" +
        "5. Cinema Hall\n" +
        "6. Screening\n" +
        "7. Prices\n" +
        "8. Reservations\n" +
        "9. Statistics\n" +
        "Press enter to exit";


    public void run() throws IOException {
        String input = "";

        while (true) {
            input = UserInput.get(mainMenuStr);

            if (input.equals("")) {
                System.out.println("\n\n\n\n\nADIOS AMIGOS!");
                break;
            }

            switch (input){
                case "1": MovieMenu.run(); break;
                case "2": GenreMenu.run(); break;
                case "3": CustomerMenu.run(); break;
                case "4": VoucherMenu.run(); break;
                case "5": CinemaHallMenu.run(); break;
                case "6": ScreeningMenu.run(); break;
                case "7": PriceMenu.run(); break;
                case "8": ReservationMenu.run(); break;
                case "9": StatisticsMenu.run(); break;
                default:
                    UserInput.badInput();
            }
        }
    }

    public void BEZVOLE() {
        System.out.println("KOWALSKI UPDATE");

//        Timestamp t = new Timestamp(System.currentTimeMillis());
//        t.setTime(t.getTime() + TimeUnit.MINUTES.toMillis(10));
//        System.out.println(t.toString());

//        GenreRepo.create("Action");
//        Genre g = GenreRepo.read(1);
//        System.out.println(g);
/*
//        Genre g = new Genre();
//        g.setName("Action");

//
////        Movie m = new Movie();
////        m.setName("Pat a Mat");
////        m.setLength(420);
////        m.setDescription("Krasny film joj");
////        m.setGenres(Set.of(g));
//
//
//
////        Genre g1 = GenreRepo.read(1);
////        Genre g2 = GenreRepo.read(3);
////
////        System.out.println(g1);
////        System.out.println(g2);
////
////
        MovieRepo.create("Pat a Mat", 122, "Yes krasny filmik", Set.of(g));
//////        System.out.println("Hotovko yeyeeeee");
////        System.out.println(MovieRepo.read(13));
////
//////        MovieRepo.update(12, "Pat a Mat", 133, "Neskutocne dobre spracovany film fakt", Set.of(g1, g2));
////
//////        System.out.println(MovieRepo.read(12));
////
////        MovieRepo.delete(13);
//
////        System.out.println(CinemaHallRepo.create("S66", 5, 8, "BASIC"));
//
//        System.out.println("mam film a zaner joj");
//
        CinemaHallRepo.create("H1", 5, 8, "BASIC");
//
        Timestamp t = new Timestamp(System.currentTimeMillis());
        ScreeningRepo.create(1, 1, t);

        CustomerRepo.create("Filo", "Magor", new Date(1999, 10, 1), "filo@filomen.sk");

        VoucherRepo.create(1, "aezakmi", new Date(2023,10,3), 3.6);

        PriceRepo.create(2.3, "CHILD", "BASIC");
        PriceRepo.create(2.4, "STUDENT", "BASIC");
        PriceRepo.create(2.9, "ADULT", "BASIC");
        PriceRepo.create(2.35, "SENIOR", "BASIC");
//
        System.out.println(ReservationRepo.create(1, 1, 1, 1, 2 ,3, 0));
        System.out.println(ScreeningRepo.freeTicketCount(1));
        System.out.println(ReservationRepo.update(1, 1, 4, "SENIOR"));
        System.out.println(ReservationRepo.update(1, 1, 2, "SENIOR"));
        System.out.println(ScreeningRepo.freeTicketCount(1));

        System.out.println(ScreeningRepo.delete(1));
 */
//        Timestamp t = new Timestamp(System.currentTimeMillis());
//        ScreeningRepo.create(1, 1, t);

//        Genre g = GenreRepo.read(1);
//        Statistics.bestsellingMoviesOfGenreInMonth(g, 4, 2022);
//        System.out.println(ScreeningRepo.screeningRevenue(1));
//        System.out.println(MovieRepo.movieRevenue(1));

        System.out.println("KOWALSKI DONE");
    }
}
