package movie.apis; import java.util.Scanner; public class Main { private static final MovieService movieService = new MovieService(); private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { System.out.println("\n=== MOVIE API CLIENT ===\n"); boolean running = true; while (running) { displayMenu(); int choice = getIntInput("Enter your choice: "); switch (choice) { case 1: movieService.displayGenres(); break; case 2: // TODO: Get genre ID and page from user, then call movieService.displayMoviesByGenre() Long genreId = getLongInput("Enter genre ID: "); Long page = getLongInput("Enter page number: "); movieService.displayMoviesByGenre(genreId, page); break; case 3: // TODO (BONUS): Get movie ID from user, then call movieService.displayMovieDetails() Long movieId = getLongInput("Enter movie ID: "); movieService.displayMovieDetails(movieId); break; case 0: running = false; System.out.println("Goodbye!"); break; default: System.out.println("Invalid choice! Please enter 0-4"); } if (running) { System.out.println("\nPress Enter to continue..."); scanner.nextLine(); scanner.nextLine(); } } scanner.close(); } private static void displayMenu() { System.out.println("\n================================"); System.out.println(" MENU"); System.out.println("================================"); System.out.println("1. Get all genres"); System.out.println("2. Get movies by genre ID"); System.out.println("3. Get movie details by ID"); System.out.println("0. Exit"); System.out.println("================================"); } private static int getIntInput(String prompt) { System.out.print(prompt); while (!scanner.hasNextInt()) { System.out.print("Invalid input. " + prompt); scanner.next(); } int input = scanner.nextInt(); scanner.nextLine(); return input; } private static Long getLongInput(String prompt) { System.out.print(prompt); while (!scanner.hasNextLong()) { System.out.print("Invalid input. " + prompt); scanner.next(); } Long input = scanner.nextLong(); scanner.nextLine(); return input; } }