-- Waitlist table for managing early-access signups

CREATE TABLE IF NOT EXISTS waitlist (
  id            uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  email         text NOT NULL UNIQUE,
  name          text,
  referral_code text,
  invited_by    text,  -- email or user handle of referrer
  status        text NOT NULL DEFAULT 'pending', -- pending, approved, rejected, invited
  notes         text,
  created_at    timestamptz NOT NULL DEFAULT now(),
  updated_at    timestamptz NOT NULL DEFAULT now()
);

CREATE INDEX IF NOT EXISTS idx_waitlist_status ON waitlist(status);
CREATE INDEX IF NOT EXISTS idx_waitlist_created ON waitlist(created_at DESC);
