CREATE TYPE "public"."atlas_category" AS ENUM('Degenerative', 'Traumatic', 'Inflammatory', 'Congenital', 'Infectious', 'Neoplastic');--> statement-breakpoint
CREATE TYPE "public"."atlas_status" AS ENUM('draft', 'published', 'archived');--> statement-breakpoint
CREATE TABLE "atlas_conditions" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"slug" text NOT NULL,
	"name" text NOT NULL,
	"region_slug" text DEFAULT '' NOT NULL,
	"category" "atlas_category" DEFAULT 'Degenerative' NOT NULL,
	"summary" text DEFAULT '' NOT NULL,
	"sections" jsonb DEFAULT '{"overview":"","epidemiology":"","symptoms":"","imaging":"","classification":"","management":"","outcomes":""}'::jsonb NOT NULL,
	"references_list" jsonb DEFAULT '[]'::jsonb NOT NULL,
	"status" "atlas_status" DEFAULT 'published' NOT NULL,
	"position" integer DEFAULT 0 NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "atlas_regions" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"slug" text NOT NULL,
	"name" text NOT NULL,
	"summary" text DEFAULT '' NOT NULL,
	"icon" text,
	"photo_url" text,
	"photo_alt" text,
	"status" "atlas_status" DEFAULT 'published' NOT NULL,
	"position" integer DEFAULT 0 NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX "atlas_conditions_slug_idx" ON "atlas_conditions" USING btree ("slug");--> statement-breakpoint
CREATE INDEX "atlas_conditions_region_idx" ON "atlas_conditions" USING btree ("region_slug");--> statement-breakpoint
CREATE INDEX "atlas_conditions_status_idx" ON "atlas_conditions" USING btree ("status");--> statement-breakpoint
CREATE UNIQUE INDEX "atlas_regions_slug_idx" ON "atlas_regions" USING btree ("slug");