-- Update Michael's work info
-- Formwork & steelfixing foreman at LFCS + Owner of RateRight

UPDATE lead_intel
SET
  personality_notes = 'Irish heritage from Achill Island, grew up in a pub. Foreman at LFCS (formwork & steelfixing). Owner of RateRight. Passionate about sports - Liverpool FC, Mayo GAA, Rabbitohs NRL, F1 (Max Verstappen). Knows the construction industry inside out.',
  interests = ARRAY['Liverpool FC supporter', 'South Sydney Rabbitohs fan', 'F1 Racing - Max Verstappen', 'Mayo GAA', 'Formwork & steelfixing', 'Construction industry'],
  hobbies = ARRAY['Following F1', 'Watching football', 'Watching NRL', 'GAA - Mayo supporter', 'Grew up working in family pub'],
  personal_news = jsonb_set(
    jsonb_set(
      personal_news,
      '{work}',
      '{"role": "Foreman", "company": "LFCS", "trade": "Formwork & Steelfixing"}'::jsonb
    ),
    '{business}',
    '"Owner of RateRight"'
  )
WHERE lead_id IN (
  SELECT id FROM leads
  WHERE (first_name ILIKE '%michael%' AND last_name ILIKE '%loughlin%')
     OR (first_name ILIKE '%michael%' AND last_name ILIKE '%rocco%')
);

-- Also update the lead company field
UPDATE leads
SET
  company = 'LFCS / RateRight',
  metadata = COALESCE(metadata, '{}'::jsonb) || '{"trade": "Formwork & Steelfixing", "role": "Foreman / Owner"}'::jsonb
WHERE (first_name ILIKE '%michael%' AND last_name ILIKE '%loughlin%')
   OR (first_name ILIKE '%michael%' AND last_name ILIKE '%rocco%');
