-- Server consultation sessions table
CREATE TABLE IF NOT EXISTS server_sessions (
  user_id TEXT PRIMARY KEY,
  status TEXT NOT NULL DEFAULT 'gathering',
  collected_info TEXT,  -- JSON
  last_recommendation TEXT,  -- JSON  
  messages TEXT,  -- JSON
  created_at INTEGER NOT NULL,
  updated_at INTEGER NOT NULL,
  expires_at INTEGER NOT NULL
);

-- Index for cleanup job
CREATE INDEX IF NOT EXISTS idx_sessions_expires ON server_sessions(expires_at);

-- Index for status queries
CREATE INDEX IF NOT EXISTS idx_sessions_status ON server_sessions(user_id, status);
