-- Fixes a dead footer link: dim_web_navigation_items already links to /privacy-policy
-- (footer "Our company" column) but no dim_web_pages row — and no frontend route —
-- ever existed for it, so it 404'd. Adds the page as a static richText block tree,
-- the same pattern used for About Us / Contact Us / Portal.
-- Idempotent (guarded by slug existence per site), additive only.
-- Deploy: mysql -u root -p db_abos_v0.1 < db/larcare_privacy_policy_seed.sql

USE db_abos_v0.1;

SET @site_id = (SELECT id FROM dim_web_sites WHERE primary_domain = 'larcareservices.com' LIMIT 1);
SET @tenant_id = (SELECT tenant_id FROM dim_web_sites WHERE id = @site_id);
SET @business_id = (SELECT business_id FROM dim_web_sites WHERE id = @site_id);

INSERT INTO dim_web_pages (tenant_id, business_id, site_id, slug, title, route, status, layout_json, meta_title)
SELECT @tenant_id, @business_id, @site_id, 'privacy-policy', 'Privacy Policy & Terms', '/privacy-policy', 'published', JSON_OBJECT(
  'version', 1,
  'blocks', JSON_ARRAY(
    JSON_OBJECT('id', 'pp-hero', 'type', 'hero', 'props', JSON_OBJECT(
      'heading', 'Privacy Policy & Terms'
    ), 'children', JSON_ARRAY()),
    JSON_OBJECT('id', 'pp-body', 'type', 'richText', 'props', JSON_OBJECT(
      'html', CONCAT(
        '<p><em>Last updated: ', DATE_FORMAT(CURDATE(), '%M %e, %Y'), '</em></p>',
        '<h2>Information We Collect</h2>',
        '<p>When you use this website — including our contact form, employment application, SMS consent form, and satisfaction survey — we collect the information you submit directly, such as your name, email address, phone number, and any message or details you provide. We do not sell this information to third parties.</p>',
        '<h2>Protected Health Information</h2>',
        '<p>Any health-related information you share with LarCare Services as part of receiving care is handled in accordance with applicable healthcare privacy regulations (including HIPAA) and is never used for marketing purposes without your explicit consent.</p>',
        '<h2>How We Use Your Information</h2>',
        '<p>We use the information you provide to respond to inquiries, process employment applications, schedule and coordinate care, send SMS updates you have opted into, and improve our services based on survey feedback.</p>',
        '<h2>SMS Communications</h2>',
        '<p>If you opt in to SMS updates, you may receive messages related to customer support, service updates, and occasional marketing communications. Message and data rates may apply. You may opt out at any time by replying STOP.</p>',
        '<h2>Third-Party Services</h2>',
        '<p>Our patient and employee Portal is provided through a secure third-party system. Use of the Portal is subject to that provider&#39;s own privacy policy and terms in addition to this policy.</p>',
        '<h2>Your Rights</h2>',
        '<p>You may request access to, correction of, or deletion of your personal information at any time by contacting us using the details below.</p>',
        '<h2>Contact Us</h2>',
        '<p>If you have questions about this Privacy Policy or our Terms, please reach out via our <a href="/about-us/contact-us">Contact Us</a> page or call us directly.</p>'
      )
    ), 'children', JSON_ARRAY())
  )
), 'Privacy Policy & Terms | LarCare Services'
WHERE @site_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM dim_web_pages WHERE site_id = @site_id AND slug = 'privacy-policy');
