-- Customer question wording requests individual orders. Align the benchmark
-- with the transaction-detail output pattern rather than forcing KPI summary.

UPDATE sg_ai_qa_question
   SET expected_focus = utl_i18n.raw_to_char(
         utl_encode.base64_decode(utl_raw.cast_to_raw(
           'Q09NTl9TQUxFU19UWE7sl5DshJwgUEFZTVRfRFRNIOq4sOykgOydvCwgUEFZTVRfQU1UID4gMTAwMDAsIEVYUFRfVVNFUl9ZTj0nTicg7KGw6rG07J2YIOqwnOuzhCDso7zrrLgg7IOB7IS466W8IOyhsO2ajO2VnOuLpC4g7KO866y4IOyLneuzhOyekCwg6rKM7J6ELCDsgqzsmqnsnpAsIOqysOygnCDsnbzsi5zsmYAg6riI7JWh7J2EIOygnOqzte2VnOuLpC4='
         )),
         'AL32UTF8'
       ),
       baseline_sql = TO_CLOB('SELECT s."PAYMT_TRANSAC_ID" AS "PAYMENT_TRANSACTION_ID",' || CHR(10)
         || '       s."PAYMT_TRANSAC_DTL_ID" AS "PAYMENT_TRANSACTION_DETAIL_ID",' || CHR(10)
         || '       s."GAME_ID" AS "GAME_ID",' || CHR(10)
         || '       s."GUID" AS "USER_ID",' || CHR(10)
         || '       s."PAYMT_DTM" AS "PAYMENT_DATETIME",' || CHR(10)
         || '       s."PAYMT_AMT" AS "PAYMENT_AMOUNT"' || CHR(10)
         || 'FROM "SGMP_POC"."COMN_SALES_TXN" s' || CHR(10)
         || 'WHERE s."PAYMT_DTM" >= DATE ''2026-07-15''' || CHR(10)
         || '  AND s."PAYMT_DTM" < DATE ''2026-07-16''' || CHR(10)
         || '  AND CAST(s."PAYMT_AMT" AS NUMBER) > 10000' || CHR(10)
         || '  AND s."EXPT_USER_YN" = ''N''' || CHR(10)
         || 'ORDER BY s."PAYMT_DTM", s."PAYMT_TRANSAC_ID", s."PAYMT_TRANSAC_DTL_ID"'),
       baseline_answer = utl_i18n.raw_to_char(
         utl_encode.base64_decode(utl_raw.cast_to_raw(
           '6rKw7KCc6riI7JWhIDHrp4zsm5Ag7LSI6rO8IOyjvOusuCA26rG07J2EIOyjvOusuCDsi53rs4TsnpAsIOqyjOyehCwg7IKs7Jqp7J6QLCDqsrDsoJwg7J287IucLCDqsrDsoJzquIjslaHqs7wg7ZWo6ruYIOuwmO2ZmO2VnOuLpC4='
         )),
         'AL32UTF8'
       )
 WHERE question_code = 'STD-18';

UPDATE sg_qa_vector_example
   SET answer_sql = TO_CLOB('SELECT s."PAYMT_TRANSAC_ID" AS "PAYMENT_TRANSACTION_ID",' || CHR(10)
         || '       s."PAYMT_TRANSAC_DTL_ID" AS "PAYMENT_TRANSACTION_DETAIL_ID",' || CHR(10)
         || '       s."GAME_ID" AS "GAME_ID",' || CHR(10)
         || '       s."GUID" AS "USER_ID",' || CHR(10)
         || '       s."PAYMT_DTM" AS "PAYMENT_DATETIME",' || CHR(10)
         || '       s."PAYMT_AMT" AS "PAYMENT_AMOUNT"' || CHR(10)
         || 'FROM "SGMP_POC"."COMN_SALES_TXN" s' || CHR(10)
         || 'WHERE s."PAYMT_DTM" >= DATE ''2026-07-15''' || CHR(10)
         || '  AND s."PAYMT_DTM" < DATE ''2026-07-16''' || CHR(10)
         || '  AND CAST(s."PAYMT_AMT" AS NUMBER) > 10000' || CHR(10)
         || '  AND s."EXPT_USER_YN" = ''N''' || CHR(10)
         || 'ORDER BY s."PAYMT_DTM", s."PAYMT_TRANSAC_ID", s."PAYMT_TRANSAC_DTL_ID"'),
       answer_text = 'Approved customer Few-shot: return individual qualifying payment orders with transaction identifiers, game, user, payment timestamp, and payment amount. Use PAYMT_DTM for the payment business date.',
       reference_status = 'APPROVED',
       inspection_status = 'VERIFIED',
       inspection_note = 'Customer benchmark aligned to detailed qualifying orders and the payment business timestamp.',
       verified_at = SYSTIMESTAMP,
       verified_by = 'SGMP_POC_METADATA_REVIEW'
 WHERE source_type = 'CUSTOMER_QA_BENCHMARK'
   AND source_case_id = 'STD-18';

COMMIT;

SELECT question_code, expected_focus, baseline_answer
  FROM sg_ai_qa_question
 WHERE question_code = 'STD-18';
