-- INTERLINK WhatsApp v2.10 - Bandeja CRM PC
-- Campos administrativos para operar WhatsApp desde el CRM.

ALTER TABLE wa2_conversations
  ADD COLUMN IF NOT EXISTS ai_paused TINYINT(1) NOT NULL DEFAULT 0,
  ADD COLUMN IF NOT EXISTS assigned_to VARCHAR(80) DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS operator_note TEXT DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS last_read_at DATETIME DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS priority VARCHAR(16) NOT NULL DEFAULT 'normal';

CREATE INDEX IF NOT EXISTS idx_wa2_conv_read ON wa2_conversations (last_read_at);
CREATE INDEX IF NOT EXISTS idx_wa2_conv_ai_paused ON wa2_conversations (ai_paused);
