-- =============================================================================
-- Set the TAT session-guidelines banner image on the TAT program type and its programs.
--
-- Banner asset:
--   https://infinitheism-serverless.s3.ap-south-1.amazonaws.com/static-images/banner/tat-banner.png
--
-- This banner is read by the session-guidelines PDFs (SESSION_GUIDELINES /
-- SESSION_INVITE_GUIDELINES) from program_v1.banner_image_url; program_type_v1.banner_url
-- is the template banner new programs inherit from.
--
-- Scope: TAT ONLY (program_type_v1.key = 'PT_TAT') — the TAT program type plus every
--        program of that type. ALL active rows in that scope (deleted_at IS NULL).
--        OVERWRITES any existing banner.
--
-- Run PER ENVIRONMENT (dev / staging / prod). Never run against prod from a local box.
-- Review the row counts printed before COMMIT.
-- =============================================================================

BEGIN;

-- TAT program type — template banner inherited by newly-created TAT programs.
UPDATE program_type_v1
SET banner_url = 'https://infinitheism-serverless.s3.ap-south-1.amazonaws.com/static-images/banner/tat-banner.png',
    updated_at = NOW()
WHERE key = 'PT_TAT'
  AND deleted_at IS NULL;

-- TAT programs — banner shown on the generated session-guidelines PDFs.
UPDATE program_v1
SET banner_image_url = 'https://infinitheism-serverless.s3.ap-south-1.amazonaws.com/static-images/banner/tat-banner.png',
    updated_at = NOW()
WHERE program_type_id IN (
        SELECT id FROM program_type_v1 WHERE key = 'PT_TAT'
      )
  AND deleted_at IS NULL;

COMMIT;
