-- =============================================================================
-- larcare_site_changes_nov2026.sql - changes from the LarCare website review call, for content that lives in the CMS:
--   1. Header menu: "About Us" becomes "Meet Our Team" and loses its dropdown; the Locations menu is removed.
--      Footer "About Us" link renamed to "Meet Our Team"; the footer Locations column is removed.
--   2. Dashes: every em dash in the site's saved copy (page content, design settings, locations, coverage, reasons,
--      footer wording) becomes plain punctuation; number ranges written with an en dash become "3 to 5".
--   3. The About page becomes a simple "Meet Our Team" page (only if it still has the original "Our Story & Mission"
--      content, so a page someone has already rewritten is left alone).
--   4. Careers: two new benefits (free college tuition in South Carolina, free health insurance).
-- Runs ONCE: it records siteChangesNov2026 in the site's theme settings, so anything edited afterwards in ABOS >
-- Website is never overwritten. Requires larcare_nav_portal.sql and larcare_page_content_seed.sql first.
-- =============================================================================
SET @site_id := (SELECT id FROM dim_web_sites WHERE public_site_key = 'pSlfeq9OCm5MvZyoFguIK7jy0uz2aKShJkxZxTSWXwzPOpYJ' AND is_deleted = 0 LIMIT 1);
SET @once := IF(@site_id IS NOT NULL AND IFNULL((SELECT JSON_UNQUOTE(JSON_EXTRACT(IFNULL(theme_json, '{}'), '$.siteChangesNov2026')) FROM dim_web_sites WHERE id = @site_id), '') <> 'true', 1, 0);
SET @c_page_content := (SELECT id FROM dim_web_collections WHERE site_id = @site_id AND collection_key = 'page-content' LIMIT 1);

-- 1. Navigation ---------------------------------------------------------------------------------------------------
SET @about_nav := (SELECT id FROM dim_web_navigation_items WHERE site_id = @site_id AND location = 'header' AND is_deleted = 0 AND parent_id IS NULL AND label COLLATE utf8mb4_bin = 'About Us' COLLATE utf8mb4_bin ORDER BY id LIMIT 1);
UPDATE dim_web_navigation_items SET is_deleted = 1 WHERE @once = 1 AND @about_nav IS NOT NULL AND parent_id = @about_nav AND is_deleted = 0;
UPDATE dim_web_navigation_items SET label = 'Meet Our Team', href = '/about-us' WHERE @once = 1 AND id = @about_nav;

SET @loc_nav := (SELECT id FROM dim_web_navigation_items WHERE site_id = @site_id AND location = 'header' AND is_deleted = 0 AND parent_id IS NULL AND label COLLATE utf8mb4_bin = 'Locations' COLLATE utf8mb4_bin ORDER BY id LIMIT 1);
UPDATE dim_web_navigation_items SET is_deleted = 1 WHERE @once = 1 AND @loc_nav IS NOT NULL AND parent_id = @loc_nav AND is_deleted = 0;
UPDATE dim_web_navigation_items SET is_deleted = 1 WHERE @once = 1 AND id = @loc_nav;

UPDATE dim_web_navigation_items SET is_deleted = 1 WHERE @once = 1 AND site_id = @site_id AND location = 'footer' AND is_deleted = 0 AND column_title COLLATE utf8mb4_bin = 'Locations' COLLATE utf8mb4_bin;
UPDATE dim_web_navigation_items SET label = 'Meet Our Team' WHERE @once = 1 AND site_id = @site_id AND location = 'footer' AND is_deleted = 0 AND label COLLATE utf8mb4_bin = 'About Us' COLLATE utf8mb4_bin AND href COLLATE utf8mb4_bin = '/about-us' COLLATE utf8mb4_bin;

-- 2. Dashes in saved copy -------------------------------------------------------------------------------------------
UPDATE fact_web_entries SET data_json = REGEXP_REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(data_json, CONVERT(UNHEX('20e28094206f757220') USING utf8mb4), CONVERT(UNHEX('2e204f757220') USING utf8mb4)), CONVERT(UNHEX('20e2809420776520') USING utf8mb4), CONVERT(UNHEX('2e20576520') USING utf8mb4)), CONVERT(UNHEX('20e2809420796f757220') USING utf8mb4), CONVERT(UNHEX('2e20596f757220') USING utf8mb4)), CONVERT(UNHEX('20e28094207468657920') USING utf8mb4), CONVERT(UNHEX('2e205468657920') USING utf8mb4)), CONVERT(UNHEX('20e2809420697420') USING utf8mb4), CONVERT(UNHEX('2e20497420') USING utf8mb4)), CONVERT(UNHEX('20e28094207468697320') USING utf8mb4), CONVERT(UNHEX('2e205468697320') USING utf8mb4)), CONVERT(UNHEX('20e2809420706c6561736520') USING utf8mb4), CONVERT(UNHEX('2e20506c6561736520') USING utf8mb4)), CONVERT(UNHEX('20e280942069747320') USING utf8mb4), CONVERT(UNHEX('2e2049747320') USING utf8mb4)), CONVERT(UNHEX('20e2809420746865697220') USING utf8mb4), CONVERT(UNHEX('2e20546865697220') USING utf8mb4)), CONVERT(UNHEX('20e2809420796f7520') USING utf8mb4), CONVERT(UNHEX('2e20596f7520') USING utf8mb4)), CONVERT(UNHEX('20e2809420') USING utf8mb4), ', '), ' \\u2014 ', ', '), CONVERT(UNHEX('285b302d395d29e28093285b302d395d29') USING utf8mb4), '\\1 to \\2')
WHERE @once = 1 AND site_id = @site_id AND is_deleted = 0 AND data_json IS NOT NULL
  AND (data_json LIKE CONCAT('%', CONVERT(UNHEX('e28094') USING utf8mb4), '%') OR data_json LIKE CONCAT('%', CONVERT(UNHEX('e28093') USING utf8mb4), '%') OR data_json LIKE '%\\u2014%');
UPDATE dim_web_sites SET theme_json = REGEXP_REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(theme_json, CONVERT(UNHEX('20e28094206f757220') USING utf8mb4), CONVERT(UNHEX('2e204f757220') USING utf8mb4)), CONVERT(UNHEX('20e2809420776520') USING utf8mb4), CONVERT(UNHEX('2e20576520') USING utf8mb4)), CONVERT(UNHEX('20e2809420796f757220') USING utf8mb4), CONVERT(UNHEX('2e20596f757220') USING utf8mb4)), CONVERT(UNHEX('20e28094207468657920') USING utf8mb4), CONVERT(UNHEX('2e205468657920') USING utf8mb4)), CONVERT(UNHEX('20e2809420697420') USING utf8mb4), CONVERT(UNHEX('2e20497420') USING utf8mb4)), CONVERT(UNHEX('20e28094207468697320') USING utf8mb4), CONVERT(UNHEX('2e205468697320') USING utf8mb4)), CONVERT(UNHEX('20e2809420706c6561736520') USING utf8mb4), CONVERT(UNHEX('2e20506c6561736520') USING utf8mb4)), CONVERT(UNHEX('20e280942069747320') USING utf8mb4), CONVERT(UNHEX('2e2049747320') USING utf8mb4)), CONVERT(UNHEX('20e2809420746865697220') USING utf8mb4), CONVERT(UNHEX('2e20546865697220') USING utf8mb4)), CONVERT(UNHEX('20e2809420796f7520') USING utf8mb4), CONVERT(UNHEX('2e20596f7520') USING utf8mb4)), CONVERT(UNHEX('20e2809420') USING utf8mb4), ', '), ' \\u2014 ', ', '), CONVERT(UNHEX('285b302d395d29e28093285b302d395d29') USING utf8mb4), '\\1 to \\2')
WHERE @once = 1 AND id = @site_id AND theme_json IS NOT NULL
  AND (theme_json LIKE CONCAT('%', CONVERT(UNHEX('e28094') USING utf8mb4), '%') OR theme_json LIKE CONCAT('%', CONVERT(UNHEX('e28093') USING utf8mb4), '%') OR theme_json LIKE '%\\u2014%');

-- 3. Meet Our Team page -----------------------------------------------------------------------------------------------
UPDATE fact_web_entries SET title = 'Meet Our Team', data_json = '{"metaTitle": "Meet Our Team | Lar Care Services", "eyebrow": "About Lar Care", "title": "Meet Our Team", "subtitle": "Larry puts the care in Lar Care.", "sections": [{"type": "split", "tone": "white", "eyebrow": "Who We Are", "title": "We Believe Everyone Deserves to Age with Dignity", "paragraphs": ["Lar Care Services was founded on a simple belief: high quality home care should be available to every family, wherever they live and whatever their income. From Chester, SC to Hopewell, VA to St. Thomas, USVI, we bring the same warmth and professionalism to every doorstep.", "We exist to bridge the gap between medical necessity and human connection. Our caregivers are not just trained professionals. They are neighbors, friends, and advocates for the people in their care."], "button": {"label": "Start a Conversation", "href": "/about-us/contact-us"}}, {"type": "cards", "tone": "light", "eyebrow": "What We Believe", "title": "What Guides Everything We Do", "items": [{"icon": "\\ud83d\\udc99", "title": "Compassion First", "text": "Every interaction begins with empathy. We see the whole person, not just the care need, and respond accordingly."}, {"icon": "\\ud83d\\udee1\\ufe0f", "title": "Integrity", "text": "We do what we say, say what we mean, and hold ourselves accountable to the families who trust us with their most vulnerable moments."}, {"icon": "\\u2b50", "title": "Excellence", "text": "We set a high bar for training, for communication, and for the quality of every care plan, and we continuously raise it."}, {"icon": "\\ud83e\\udd32", "title": "Respect & Dignity", "text": "Every client is treated as a valued individual with their own story, preferences, and rights, without exception."}]}, {"type": "split", "tone": "white", "eyebrow": "Our Team", "title": "We Care for Your Family the Way We Would Care for Ours", "paragraphs": ["Our leadership and operations team bring more than 150 years of combined professional experience, from business operations and healthcare management to ministry and community development.", "That experience is the core of Lar Care. We bring all of it to every client, so each family gets care that feels like family."]}]}'
WHERE @once = 1 AND 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')) = CONVERT(UNHEX('4f75722053746f72792026204d697373696f6e') USING utf8mb4);

-- 4. Careers benefits -----------------------------------------------------------------------------------------------
UPDATE fact_web_entries SET data_json = JSON_ARRAY_APPEND(data_json, '$.sections[0].items', JSON_OBJECT('icon', CONVERT(UNHEX('f09f8fab') USING utf8mb4), 'title', CONVERT(UNHEX('4672656520436f6c6c6567652054756974696f6e20696e20536f757468204361726f6c696e61') USING utf8mb4), 'text', CONVERT(UNHEX('5465616d206d656d6265727320696e20536f757468204361726f6c696e612063616e20676f20746f20636f6c6c65676520776974682074686569722074756974696f6e207061696420666f722e') USING utf8mb4)))
WHERE @once = 1 AND site_id = @site_id AND collection_id = @c_page_content AND slug = 'careers' AND is_deleted = 0 AND JSON_VALID(data_json)
  AND JSON_UNQUOTE(JSON_EXTRACT(data_json, '$.sections[0].title')) = CONVERT(UNHEX('4120576f726b706c61636520546861742056616c75657320596f75') USING utf8mb4)
  AND data_json NOT LIKE CONCAT('%', CONVERT(UNHEX('4672656520436f6c6c6567652054756974696f6e20696e20536f757468204361726f6c696e61') USING utf8mb4), '%');
UPDATE fact_web_entries SET data_json = JSON_ARRAY_APPEND(data_json, '$.sections[0].items', JSON_OBJECT('icon', CONVERT(UNHEX('f09fa9ba') USING utf8mb4), 'title', CONVERT(UNHEX('46726565204865616c746820496e737572616e6365') USING utf8mb4), 'text', CONVERT(UNHEX('4865616c746820696e737572616e636520697320617661696c61626c6520746f206f7572207465616d206d656d62657273206174206e6f20636f737420746f20796f752e') USING utf8mb4)))
WHERE @once = 1 AND site_id = @site_id AND collection_id = @c_page_content AND slug = 'careers' AND is_deleted = 0 AND JSON_VALID(data_json)
  AND JSON_UNQUOTE(JSON_EXTRACT(data_json, '$.sections[0].title')) = CONVERT(UNHEX('4120576f726b706c61636520546861742056616c75657320596f75') USING utf8mb4)
  AND data_json NOT LIKE CONCAT('%', CONVERT(UNHEX('46726565204865616c746820496e737572616e6365') USING utf8mb4), '%');

UPDATE dim_web_sites SET theme_json = JSON_SET(IFNULL(theme_json, '{}'), '$.siteChangesNov2026', 'true') WHERE id = @site_id AND @once = 1;
