-- ================================================================
-- Automation Messages Update SQL (FIXED)
-- Run this in cPanel phpMyAdmin → Select your DB → SQL tab
-- ================================================================

-- Step 1: Clear old automation messages
DELETE FROM automation_messages;

-- Step 2: Insert new automation flow

-- MESSAGE 1: Text Only (no image, no button)
INSERT INTO automation_messages (step_key, step_order, step_type, message_text, button_text, media_json, delay_seconds, is_enabled) VALUES
('step_1', 1, 'text_only',
'Thank you for subscription!🙏🏻
🎁 1 bonus is available for you! Click the button to continue!',
'', '[]', 0, 1);

-- MESSAGE 2: Single Image + Text (no button)
INSERT INTO automation_messages (step_key, step_order, step_type, message_text, button_text, media_json, delay_seconds, is_enabled) VALUES
('step_1_followup', 2, 'single_image_text',
'If you''re looking for "quick and easy," you''re not looking for me.

👛🔄 But if you''re ready for the real working system, click READY below⤵️',
'', '["https://i.ibb.co/1Y39dQgM/IMG-20260604-WA0020.jpg"]', 0, 1);

-- MESSAGE 3: Single Image + Text (no button)
INSERT INTO automation_messages (step_key, step_order, step_type, message_text, button_text, media_json, delay_seconds, is_enabled) VALUES
('step_2', 3, 'single_image_text',
'💵➕💰 Start building a supplemental income to your salary or pension today

Its, will you start now or in a year?',
'', '["https://i.ibb.co/4nYtsQ6z/IMG-20260604-WA0019.jpg"]', 0, 1);

-- MESSAGE 4: 4 Images (media group) + Caption + START button
INSERT INTO automation_messages (step_key, step_order, step_type, message_text, button_text, media_json, delay_seconds, is_enabled) VALUES
('step_3', 4, 'multi_image_text',
'🧿 Activate code NEW-1 to join with a welcome bonus!

Best conditions and bonuses already available to you! Click /START to continue!',
'START', '["https://i.ibb.co/whR6Hdpg/IMG-20260604-WA0015.jpg","https://i.ibb.co/8QZqWVT/IMG-20260604-WA0018.jpg","https://i.ibb.co/7JrfWntY/IMG-20260604-WA0016.jpg","https://i.ibb.co/9kJ5z8sB/IMG-20260604-WA0017.jpg"]', 0, 1);

-- FALLBACK: Sent on any message or button click
INSERT INTO automation_messages (step_key, step_order, step_type, message_text, button_text, media_json, delay_seconds, is_enabled) VALUES
('fallback', 5, 'fallback',
'👋🏻 I have a quick update for you. Please message me privately👉🏻 @Anita_Desai_here',
'', '[]', 0, 1);

-- Verify result:
SELECT step_key, step_order, step_type, LEFT(message_text,50) AS preview, button_text FROM automation_messages ORDER BY step_order;
