import { NextResponse } from 'next/server';
import { withAuth } from '../../../../lib/with-auth';

const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL || 'http://recipe-api:8080';

export const DELETE = withAuth(async (_request, session, context) => {
  const { productId } = await context.params;
  const res = await fetch(`${API_BASE}/api/user-products/${productId}`, {
    method: 'DELETE',
    headers: { Authorization: `Bearer ${session.accessToken}` },
  });
  return new NextResponse(null, { status: res.status });
});
