-- =====================================================
-- PT_PAP — venue / venue_name_in_emails correction (program_type_v1 + program_v1)
-- 2026-08-08
-- DRAFT ONLY — not executed against any database, not yet reviewed/approved.
-- Config only. Idempotent (plain UPDATE, safe to re-run).
-- =====================================================
--
-- Replaces the placeholder HDB/MSD venue that
-- 2026-08-07-01-pt-pap-program-type-workflow.sql flagged as "literally HDB/MSD's venue;
-- PAP's real venue is unconfirmed and must be set before go-live" (see that file's §1
-- comments on venue/venue_name_in_emails), with the confirmed real venue. Not env-specific
-- (unlike 2026-08-08-01-pt-pap-logo-banner-update.sql's per-env S3 URLs) — same address
-- across Dev/QA/UAT/Prod, so this runs as a single block everywhere.
--
-- Two targets:
--   1. program_type_v1 — the PT_PAP row's own venue/venue_name_in_emails, used as the
--      fallback default at program-create time.
--   2. program_v1 — any PAP program instance(s) already created under PT_PAP, whose own
--      venue/venue_name_in_emails were copied from the program_type_v1 placeholder at
--      creation time and won't pick up this fix retroactively otherwise.
-- =====================================================

UPDATE program_type_v1
SET venue               = 'Radisson Blu Resort Temple Bay, 57, Covelong Road, Mamallapuram, Tamil Nadu – 603104.',
    venue_name_in_emails = 'Radisson Blu Resort Temple Bay, 57, Covelong Road, Mamallapuram, Tamil Nadu – 603104.',
    updated_at           = NOW(),
    updated_by           = -2
WHERE key = 'PT_PAP'
  AND deleted_at IS NULL;

UPDATE program_v1 p
SET venue               = 'Radisson Blu Resort Temple Bay, 57, Covelong Road, Mamallapuram, Tamil Nadu – 603104.',
    venue_name_in_emails = 'Radisson Blu Resort Temple Bay, 57, Covelong Road, Mamallapuram, Tamil Nadu – 603104.',
    updated_at           = NOW(),
    updated_by           = -2
WHERE p.deleted_at IS NULL
  AND p.program_type_id IN (
        SELECT id FROM program_type_v1 WHERE key = 'PT_PAP' AND deleted_at IS NULL
  );
