-- Add fields for Puck nav editor support
-- These fields track default nav items and their visibility across tiers

-- Add isDefault flag to identify system-provided nav items
ALTER TABLE "NavigationItem" ADD COLUMN "isDefault" BOOLEAN NOT NULL DEFAULT false;

-- Add defaultKey for identifying nav items (e.g., "shop-online", "about.blog")
ALTER TABLE "NavigationItem" ADD COLUMN "defaultKey" TEXT;

-- Add defaultSortOrder to preserve original ordering for validation
ALTER TABLE "NavigationItem" ADD COLUMN "defaultSortOrder" INTEGER;

-- Add isVisible for soft-hiding items on tier downgrade
ALTER TABLE "NavigationItem" ADD COLUMN "isVisible" BOOLEAN NOT NULL DEFAULT true;

-- Create unique constraint for dealer+defaultKey to prevent duplicate defaults
CREATE UNIQUE INDEX "NavigationItem_dealerId_defaultKey_key" ON "NavigationItem"("dealerId", "defaultKey");
