-- Original artwork selection and automated public-table seats. All chips remain free/nonredeemable.
ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_id smallint NOT NULL DEFAULT 1 CHECK (avatar_id BETWEEN 1 AND 10);
ALTER TABLE users ADD COLUMN IF NOT EXISTS is_bot boolean NOT NULL DEFAULT false;
CREATE INDEX IF NOT EXISTS idx_users_is_bot ON users(is_bot);
-- Bots are non-login service identities for round FK and audit consistency; no wallets or sessions.
INSERT INTO users(name,email,referral_code,email_verified,is_bot,avatar_id)
SELECT (ARRAY['Arjun','Meera','Dev','Tara','Rishi','Naina','Kabir','Diya','Aryan','Kiara',
              'Raj','Anika','Vikram','Sana','Aman','Riya','Karan','Pooja','Rohit','Neha'])[1 + ((n-1) % 20)],
  'royal-seat-' || lpad(n::text,3,'0') || '@bots.invalid',
  'AUT' || lpad(n::text,8,'0'),true,true,1 + ((n-1) % 10)
FROM generate_series(1,120) AS n
ON CONFLICT(email) DO NOTHING;
