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 List<MenuItem> getMenuItems() {
        return menuItemDao.findAll();
    }

    public void showMenu() {
        List<MenuItem> items = getMenuItems();
        System.out.println("\n--- MENU ---");
        System.out.printf("%-5s %-25s %-12s %s%n", "ID", "Name", "Price", "Category");
        System.out.println("-".repeat(55));
        for (MenuItem item : items) {
            System.out.printf("%-5d %-25s $%-11.2f %s%n",
                    item.getId(), item.getName(), item.getPrice(), item.getCategory());
        }
        System.out.println("-".repeat(55));
    }
}