import type { FastifyInstance } from 'fastify';
import type { FastifySchema } from 'fastify';

const healthSchema: FastifySchema = {
  tags: ['Health'],
  summary: 'Health check',
  description: 'Verifica que el servicio está operativo.',
  response: {
    200: {
      type: 'object',
      properties: {
        status: { type: 'string', const: 'ok' },
      },
    },
  },
};

export async function registerHealthRoutes(app: FastifyInstance): Promise<void> {
  app.get('/health', { schema: healthSchema }, async (): Promise<{ status: 'ok' }> => {
    return { status: 'ok' };
  });
}
