import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { waffleIngredientInclude } from "@/lib/waffle-ingredients";

/** Données vitrine uniquement (pas de métadonnées internes). */
export async function GET() {
  const rows = await prisma.waffle.findMany({
    orderBy: [{ category: "asc" }, { name: "asc" }],
    select: {
      id: true,
      name: true,
      ingredients: true,
      price: true,
      isNew: true,
      category: true,
      imageUrl: true,
      ingredientItems: waffleIngredientInclude.ingredientItems,
    },
  });
  return NextResponse.json(rows);
}
