CREATE TYPE "public"."user_profiles_property_count" AS ENUM('1', '2–5', '6–20', '21+', '1–50', '51–100', '101–300', '301–1000', '1000+');--> statement-breakpoint
CREATE TYPE "public"."user_profiles_referral_source" AS ENUM('search', 'social_media', 'NRLA', 'partner', 'word_of_mouth', 'other');--> statement-breakpoint
CREATE TYPE "public"."user_profiles_user_type" AS ENUM('private_landlord', 'private_tenant', 'social_landlord', 'social_tenant', 'homeowner', 'other');--> statement-breakpoint
CREATE TABLE "user_profiles" (
	"id" bigserial PRIMARY KEY NOT NULL,
	"user_id" bigint NOT NULL,
	"user_type" "user_profiles_user_type" NOT NULL,
	"property_count" "user_profiles_property_count",
	"goals" json,
	"referral_source" "user_profiles_referral_source",
	"nrla_membership_id" varchar(255),
	"accepted_privacy" boolean DEFAULT false NOT NULL,
	"accepted_privacy_at" timestamp (6) with time zone,
	"marketing_opt_in" boolean DEFAULT false,
	"marketing_opt_in_at" timestamp (6) with time zone,
	"first_name" text,
	"last_name" text,
	"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
	"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "user_profiles" ADD CONSTRAINT "user_profiles_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;