-- CreateTable
CREATE TABLE "AgentSuggestion" (
    "id" TEXT NOT NULL,
    "userId" TEXT NOT NULL,
    "topic" TEXT NOT NULL,
    "reason" TEXT NOT NULL,
    "suggestedRole" TEXT NOT NULL,
    "suggestedType" TEXT NOT NULL DEFAULT 'researcher',
    "suggestedFrequency" TEXT NOT NULL DEFAULT 'weekly',
    "relatedNoteIds" TEXT NOT NULL,
    "clusterId" INTEGER,
    "status" TEXT NOT NULL DEFAULT 'pending',
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE INDEX "AgentSuggestion_userId_status_idx" ON "AgentSuggestion"("userId", "status");

-- CreateIndex
CREATE UNIQUE INDEX "AgentSuggestion_userId_clusterId_key" ON "AgentSuggestion"("userId", "clusterId");

-- AddForeignKey
ALTER TABLE "AgentSuggestion" ADD CONSTRAINT "AgentSuggestion_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
