-- ============================================
-- MIGRACIÓN 018: Representantes legales del lead
-- ============================================

CREATE TABLE IF NOT EXISTS lead_representatives (
    id INT AUTO_INCREMENT PRIMARY KEY,
    lead_id INT NOT NULL,
    tipo_documento VARCHAR(20) NULL,
    numero_documento VARCHAR(20) NULL,
    nombre VARCHAR(250) NOT NULL,
    cargo VARCHAR(200) NULL,
    fecha_desde DATE NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (lead_id) REFERENCES leads(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE INDEX idx_lead_representatives_lead_id ON lead_representatives(lead_id);
