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

export const GET = withErrorHandler(
  withAuth(async (req: AuthedRequest, ctx: RouteContext) => {
    const { id } = await ctx.params;
    const overrides = await listBranchAvailability(id, req.session.restaurantId!);
    return NextResponse.json({ overrides });
  })
);
