-- =============================================================================
-- larcare_team_photo.sql - puts the team photo (/images/team/lar-care-team.jpeg) next to the "Who We Are" text on the
-- Meet Our Team page. Changes the saved page only while its first section still has no image, so a photo someone
-- already chose in ABOS > Website > Collections is never replaced. Safe to run again.
-- Requires larcare_site_changes_nov2026.sql first.
-- =============================================================================
SET @site_id := (SELECT id FROM dim_web_sites WHERE public_site_key = 'pSlfeq9OCm5MvZyoFguIK7jy0uz2aKShJkxZxTSWXwzPOpYJ' AND is_deleted = 0 LIMIT 1);
SET @c_page_content := (SELECT id FROM dim_web_collections WHERE site_id = @site_id AND collection_key = 'page-content' LIMIT 1);

UPDATE fact_web_entries
SET data_json = JSON_SET(data_json,
      '$.sections[0].image', '/images/team/lar-care-team.jpeg',
      '$.sections[0].imageAlt', 'The Lar Care team on the steps at 178 Columbia Street',
      '$.sections[0].imageSide', 'right')
WHERE site_id = @site_id AND collection_id = @c_page_content AND slug = 'about' AND is_deleted = 0 AND JSON_VALID(data_json)
  AND JSON_UNQUOTE(JSON_EXTRACT(data_json, '$.title')) = 'Meet Our Team'
  AND JSON_UNQUOTE(JSON_EXTRACT(data_json, '$.sections[0].type')) = 'split'
  AND JSON_EXTRACT(data_json, '$.sections[0].image') IS NULL;
