/**
 * JSON Schema for the Strategic Plan generated by the Planner Agent.
 * Using a dedicated schema file improves AI clarity and reduces the context budget of the main handler.
 */
export const StrategicPlanSchema = {
  type: 'object' as const,
  properties: {
    status: { type: 'string', enum: ['SUCCESS', 'FAILED'] },
    plan: { type: 'string' },
    coveredGapIds: { type: 'array', items: { type: 'string' } },
    tasks: {
      type: 'array',
      items: {
        type: 'object',
        properties: {
          agentId: { type: 'string', enum: ['CODER', 'RESEARCHER'] },
          task: { type: 'string' },
          gapIds: { type: 'array', items: { type: 'string' } },
        },
        required: ['agentId', 'task', 'gapIds'],
        additionalProperties: false,
      },
    },
    toolOptimizations: {
      type: 'array',
      items: {
        type: 'object',
        properties: {
          action: { type: 'string', enum: ['PRUNE', 'CONSOLIDATE', 'REPLACE'] },
          toolName: { type: 'string' },
          reason: { type: 'string' },
        },
        required: ['action', 'toolName', 'reason'],
        additionalProperties: false,
      },
    },
  },
  required: ['status', 'plan', 'coveredGapIds'],
  additionalProperties: false,
};
