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

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