/**
 * Minimal Cost Test Prompts
 *
 * Carefully crafted prompts designed to minimize token usage while
 * testing specific CLI behaviors. Each prompt aims for the smallest
 * possible API cost while still exercising the target functionality.
 *
 * Cost estimates assume Claude Sonnet pricing (~$3/M input, $15/M output).
 */

export const MINIMAL_PROMPTS = {
  /**
   * ~$0.01 - Cheapest done response
   * Tests: basic spawn → completion flow, status parsing
   */
  done: `Output exactly this JSON with no other text:
{"status":"done","result":"ok"}`,

  /**
   * ~$0.01 - Cheapest questions response
   * Tests: waiting_for_input status, questions array parsing
   */
  questions: `Output exactly this JSON with no other text:
{"status":"questions","questions":[{"id":"q1","question":"What is your name?"}]}`,

  /**
   * ~$0.03 - Slow task for timing tests
   * Tests: streaming during long-running task, crash recovery
   * Note: Agent may not actually wait 30 seconds, but will produce delayed output
   */
  slow: `Think through a simple problem step by step, counting from 1 to 10 slowly, then output:
{"status":"done","result":"counted to 10"}`,

  /**
   * ~$0.02 - Produces text deltas for streaming tests
   * Tests: text_delta event parsing, output buffering
   */
  streaming: `Count from 1 to 5, outputting each number, then output:
{"status":"done","result":"counted"}`,

  /**
   * ~$0.03 - Deliberately produces non-JSON first
   * Tests: schema validation failure, retry logic
   */
  badThenGood: `First say "thinking..." on its own line, then output:
{"status":"done","result":"fixed"}`,

  /**
   * ~$0.02 - Multiple questions
   * Tests: questions array with multiple items
   */
  multipleQuestions: `Output exactly this JSON with no other text:
{"status":"questions","questions":[{"id":"q1","question":"First question?"},{"id":"q2","question":"Second question?"}]}`,

  /**
   * ~$0.01 - Error signal
   * Tests: error status handling
   */
  error: `Output exactly this JSON with no other text:
{"status":"error","error":"Test error message"}`,

  /**
   * ~$0.02 - Answer continuation
   * Tests: session resume with answers
   */
  answerContinuation: (answers: Record<string, string>): string => {
    const answerLines = Object.entries(answers)
      .map(([id, answer]) => `${id}: ${answer}`)
      .join('\n');
    return `I received your answers:
${answerLines}

Now complete the task by outputting:
{"status":"done","result":"completed with answers"}`;
  },

  /**
   * ~$0.02 - Context complete for discuss mode
   * Tests: discuss mode output handling (now uses universal done signal)
   */
  discussComplete: `Output exactly this JSON with no other text:
{"status":"done"}`,

  /**
   * ~$0.02 - Plan complete
   * Tests: plan mode output handling (now uses universal done signal)
   */
  planComplete: `Output exactly this JSON with no other text:
{"status":"done"}`,

  /**
   * ~$0.02 - Detail complete
   * Tests: detail mode output handling (now uses universal done signal)
   */
  detailComplete: `Output exactly this JSON with no other text:
{"status":"done"}`,
} as const;

/**
 * Prompts specifically for Codex provider testing.
 * Codex may have different output format requirements.
 */
export const CODEX_PROMPTS = {
  /**
   * Basic completion for Codex
   */
  done: `Complete this simple task: output "done" and finish.`,

  /**
   * Produces streaming output
   */
  streaming: `Count from 1 to 5, saying each number aloud, then say "finished".`,
} as const;
