-- Migration 005 — Onboarding conversacional ("la Vale que configura").
-- Aplica sobre SCHEMA.sql + 002 + 003 + 004.

ALTER TABLE tenants
    ADD COLUMN business_type VARCHAR(80) NULL,
    ADD COLUMN profile_kind ENUM('cita','reserva','pedido','lead','generic') NOT NULL DEFAULT 'generic',
    ADD COLUMN onboarding_status ENUM('chatting','configuring','live') NOT NULL DEFAULT 'chatting';

ALTER TABLE vale_config ADD COLUMN persona TEXT NULL;

-- Backfill: los negocios que YA tienen servicios quedan 'live' (no re-onboardear).
UPDATE tenants t SET onboarding_status = 'live'
WHERE EXISTS (SELECT 1 FROM services s WHERE s.tenant_id = t.id);
