import type { FastifyInstance } from 'fastify';
import { getReportHandler } from '../controllers/report.controller.js';
import { authorize } from '../plugins/authorize.js';
import { PERMISSIONS } from '../constants/permissions.js';
import { reportQuerySchema } from '../schemas/report.schema.js';

export default async function reportRoutes(fastify: FastifyInstance) {
  fastify.get('/api/reports/:category/:reportId', {
    preHandler: [authorize(PERMISSIONS.REPORTS_VIEW)],
    schema: reportQuerySchema,
  }, getReportHandler);
}
