-- CreateEnum
CREATE TYPE "UserQuestionStatus" AS ENUM ('pending', 'answered');

-- AlterEnum
ALTER TYPE "ClaudeJobKind" ADD VALUE 'PLAN_CHAT';

-- CreateTable
CREATE TABLE "user_questions" (
    "id" TEXT NOT NULL,
    "idea_id" TEXT NOT NULL,
    "user_id" TEXT NOT NULL,
    "question" TEXT NOT NULL,
    "answer" TEXT,
    "status" "UserQuestionStatus" NOT NULL DEFAULT 'pending',
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "user_questions_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "user_questions_idea_id_status_idx" ON "user_questions"("idea_id", "status");

-- CreateIndex
CREATE INDEX "user_questions_user_id_idx" ON "user_questions"("user_id");

-- AddForeignKey
ALTER TABLE "user_questions" ADD CONSTRAINT "user_questions_idea_id_fkey" FOREIGN KEY ("idea_id") REFERENCES "ideas"("id") ON DELETE CASCADE ON UPDATE CASCADE;
