package dev.service;

import dev.dao.MenuItemDao;
import dev.model.MenuItem;
import java.util.List;

public class MenuService {

    private final MenuItemDao menuItemDao = new MenuItemDao();

    public void showMenu() {
        List<MenuItem> items = menuItemDao.findAll();

        if (items == null || items.isEmpty()) {
            System.out.println("The menu is currently empty.");
            return;
        }

        System.out.println("\n=======================================");
        System.out.println("            🍽️ OUR MENU 🍽️            ");
        System.out.println("=======================================");
        System.out.printf("%-4s | %-12s | %-7s | %-20s\n", "ID", "Name", "Price", "Description");
        System.out.println("---------------------------------------");

        for (MenuItem item : items) {
            System.out.printf("%-4d | %-12s | $%-6.2f | %-20s\n",
                    item.getId(),
                    item.getName(),
                    item.getPrice(),
                    item.getDescription() != null ? item.getDescription() : "");
        }
        System.out.println("=======================================");
    }
}