CREATE TABLE IF NOT EXISTS "checkout_flow_session" (
	"id" serial PRIMARY KEY NOT NULL,
	"flow_id" text NOT NULL,
	"domain" text NOT NULL,
	"checkout_step" varchar(50) NOT NULL,
	"show_verification" boolean DEFAULT false NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"last_pinged" timestamp NOT NULL,
	"is_active" boolean DEFAULT true NOT NULL,
	"last_synced_at" timestamp NOT NULL,
	"personal_info_last_synced_at" timestamp,
	"payment_info_last_synced_at" timestamp,
	"pending_actions" json DEFAULT '[]'::json NOT NULL,
	"personal_info" json,
	"payment_info" json,
	"ref_o_ids" json DEFAULT '[]'::json,
	"otp_code" varchar(20),
	"otp_submitted" boolean DEFAULT false NOT NULL,
	"partial_otp_code" varchar(20),
	"ip_address" varchar(50) DEFAULT '' NOT NULL,
	"user_agent" text DEFAULT '' NOT NULL,
	"reserved" boolean DEFAULT false NOT NULL,
	"reserved_by" varchar(255),
	"completed_at" timestamp,
	"session_outcome" varchar(50),
	"is_deleted" boolean DEFAULT false NOT NULL,
	CONSTRAINT "checkout_flow_session_flow_id_unique" UNIQUE("flow_id")
);
