CREATE TABLE "pricing_configs" (
    "id"            TEXT NOT NULL,
    "plan"          TEXT NOT NULL,
    "billingPeriod" TEXT NOT NULL,
    "amount"        INTEGER NOT NULL,
    "updatedAt"     TIMESTAMP(3) NOT NULL,
    "updatedBy"     TEXT,

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

CREATE UNIQUE INDEX "pricing_configs_plan_billingPeriod_key" ON "pricing_configs"("plan", "billingPeriod");

-- Seed default prices (amounts in centimes MAD)
INSERT INTO "pricing_configs" ("id", "plan", "billingPeriod", "amount", "updatedAt") VALUES
  ('prc_starter_monthly', 'STARTER', 'MONTHLY',   2990, NOW()),
  ('prc_starter_annual',  'STARTER', 'ANNUAL',   29900, NOW()),
  ('prc_growth_monthly',  'GROWTH',  'MONTHLY',   3990, NOW()),
  ('prc_growth_annual',   'GROWTH',  'ANNUAL',   39900, NOW()),
  ('prc_pro_monthly',     'PRO',     'MONTHLY',  99900, NOW()),
  ('prc_pro_annual',      'PRO',     'ANNUAL',  999000, NOW());
