import { registerTool } from '../tools/registry.js';
import {
  runRegressionWatchPipeline,
  RegressionWatchInputSchema,
} from './regression-watch-pipeline.js';
import {
  runPostIncidentCleanupPipeline,
  PostIncidentCleanupInputSchema,
} from './post-incident-cleanup-pipeline.js';

registerTool({
  name: 'a2a.regressionWatch',
  description:
    'A2A pipeline: Monitor telemetry error clusters and automatically create diagnostics sessions when thresholds are exceeded. Requires admin role.',
  requiredRole: 'admin',
  inputSchema: RegressionWatchInputSchema,
  async execute(args, req) {
    return runRegressionWatchPipeline(args, req);
  },
});

registerTool({
  name: 'a2a.postIncidentCleanup',
  description:
    'A2A pipeline: Clean up after an incident - resolve clusters, delete temporary policies, and export audit logs. Requires admin role.',
  requiredRole: 'admin',
  inputSchema: PostIncidentCleanupInputSchema,
  async execute(args, req) {
    return runPostIncidentCleanupPipeline(args, req);
  },
});
