-- Content management primitives for PDF-derived Navi visual assets.

CREATE TABLE "ContentAsset" (
    "id" TEXT NOT NULL,
    "key" TEXT NOT NULL,
    "title" TEXT NOT NULL,
    "type" TEXT NOT NULL,
    "url" TEXT NOT NULL,
    "altText" TEXT NOT NULL,
    "screen" TEXT NOT NULL,
    "section" TEXT NOT NULL,
    "status" TEXT NOT NULL DEFAULT 'DRAFT',
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

CREATE TABLE "MarketingPage" (
    "id" TEXT NOT NULL,
    "slug" TEXT NOT NULL,
    "title" TEXT NOT NULL,
    "heroImageUrl" TEXT,
    "sectionsJson" JSONB NOT NULL,
    "status" TEXT NOT NULL DEFAULT 'DRAFT',
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

CREATE TABLE "OnboardingPage" (
    "id" TEXT NOT NULL,
    "step" INTEGER NOT NULL,
    "title" TEXT NOT NULL,
    "subtitle" TEXT NOT NULL,
    "imageUrl" TEXT NOT NULL,
    "ctaLabel" TEXT NOT NULL,
    "secondaryCtaLabel" TEXT,
    "sortOrder" INTEGER NOT NULL,
    "status" TEXT NOT NULL DEFAULT 'DRAFT',
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

CREATE UNIQUE INDEX "ContentAsset_key_key" ON "ContentAsset"("key");
CREATE INDEX "ContentAsset_screen_section_status_idx" ON "ContentAsset"("screen", "section", "status");

CREATE UNIQUE INDEX "MarketingPage_slug_key" ON "MarketingPage"("slug");
CREATE INDEX "MarketingPage_status_idx" ON "MarketingPage"("status");

CREATE UNIQUE INDEX "OnboardingPage_step_key" ON "OnboardingPage"("step");
CREATE INDEX "OnboardingPage_status_sortOrder_idx" ON "OnboardingPage"("status", "sortOrder");
