import type { JobDefinition } from './job-definition.types';

/**
 * M-AI-07-02: Quiz Generation Job Definition（冻结）
 *
 * 对应迁移契约 docs/architecture/m-ai-07-quiz-generation-migration-contract.md
 *
 * 字段取值来源：
 * - promptKey: quiz-generation（契约 §5.1 — 当前由外部 Runtime 管理，M-AI-07-03 内联）
 * - modelTier: primary（契约 A5 — 从硬编码 deepseek-chat 迁移到 ModelRouter）
 * - queueName: ai-interactive（Quiz 生成为用户交互请求）
 * - input.schemaVersion: quiz-generation-v1
 * - output.schemaVersion: quiz-generation-v1
 * - timeoutMs: 180000（3min，生成题目比评估更耗时）
 * - maxRetries: 3
 * - domain: generation
 */

export const QUIZ_GENERATION_JOB_DEFINITION: JobDefinition = {
  jobType: 'quiz_generation',

  metadata: {
    label: 'Quiz Generation',
    description:
      'Generate quiz questions from knowledge base content. ' +
      'Creates choice, fill-in-the-blank, and true/false questions ' +
      'with options, answers, and explanations.',
    domain: 'generation',
    version: '1.0.0',
  },

  queue: {
    queueName: 'ai-interactive',
    defaultPriority: 0,
  },

  execution: {
    timeoutMs: 180_000,
    maxRetries: 3,
    retryBackoff: { type: 'exponential', delay: 1000 },
    cancellable: true,
    abortStrategy: 'fail',
  },

  input: {
    schemaVersion: 'quiz-generation-v1',
  },

  output: {
    schemaVersion: 'quiz-generation-v1',
  },

  prompt: {
    promptKey: 'quiz-generation',
    promptVersion: '1.0.0',
  },

  model: {
    modelTier: 'primary',
    modelProvider: 'deepseek',
    modelName: 'deepseek-v4-pro',  // ModelRouter primary tier (model-router.ts:25)
    maxTokens: 4096,
  },

  credential: {
    allowedModes: ['platform_key'],
    defaultMode: 'platform_key',
  },

  projectorKey: 'quiz_generation_projector',

  security: {
    contentSafetyCheck: true,
    outputRedaction: false,
  },
};
