import { NextResponse } from 'next/server';
import { withErrorHandler } from '@server/middleware/withErrorHandler';
import { withAuth, AuthedRequest } from '@server/middleware/withAuth';
import { listLowStockItems } from '@server/services/menu.service';

export const GET = withErrorHandler(
  withAuth(async (req: AuthedRequest) => {
    const items = await listLowStockItems(req.session.restaurantId!);
    return NextResponse.json({ items });
  })
);
