// src/adapters/claude/questions/utils.ts
import { z } from "zod";
var OPTION_PREFIX = "option_";
var QuestionOptionSchema = z.object({
  label: z.string(),
  description: z.string().optional()
});
var QuestionItemSchema = z.object({
  question: z.string(),
  header: z.string().optional(),
  options: z.array(QuestionOptionSchema),
  multiSelect: z.boolean().optional(),
  completed: z.boolean().optional()
});
var QuestionMetaSchema = z.object({
  questions: z.array(QuestionItemSchema)
});
function normalizeAskUserQuestionInput(input) {
  if (input.questions && input.questions.length > 0) {
    return input.questions;
  }
  if (input.question) {
    return [
      {
        question: input.question,
        header: input.header,
        options: input.options || [],
        multiSelect: input.multiSelect
      }
    ];
  }
  return null;
}
function buildQuestionToolCallData(questions) {
  return {
    toolCallId: `question-${Date.now()}`,
    title: questions[0]?.question ?? "Question",
    kind: "other",
    content: [],
    _meta: {
      codeToolKind: "question",
      questions
    }
  };
}
function buildQuestionOptions(question) {
  return question.options.map((opt, idx) => ({
    kind: "allow_once",
    name: opt.label,
    optionId: `${OPTION_PREFIX}${idx}`,
    _meta: opt.description ? { description: opt.description } : void 0
  }));
}
export {
  OPTION_PREFIX,
  QuestionItemSchema,
  QuestionMetaSchema,
  QuestionOptionSchema,
  buildQuestionOptions,
  buildQuestionToolCallData,
  normalizeAskUserQuestionInput
};
//# sourceMappingURL=utils.js.map