package dev.service;
import dev.dao.MenuItemDao;
import dev.model.MenuItem;

import java.util.List;
public class MenuService {
    private MenuItemDao menuItemDao = new MenuItemDao();
    public void showMenu() {
        List<MenuItem> items = menuItemDao.findAll();
        if (items.isEmpty()) {
            System.out.println("No menu items available.");
            return;
        }
        System.out.println("\n--- Menu ---");
        System.out.printf("%-4s %-25s %-10s %s\n", "ID", "Name", "Price", "Category");
        System.out.println("------------------------------------------------");
        for (MenuItem item : items) {
            System.out.printf("%-4d %-25s $%-9.2f %s\n",
                    item.getId(), item.getName(), item.getPrice(), item.getCategory());
        }
    }

    public MenuItem getMenuItemById(int id) {
        return menuItemDao.findById(id);
    }

}