-- Make producer mention mandatory in every AI writer result.

UPDATE app_settings
SET value_json = to_jsonb(
    CASE
      WHEN (value_json #>> '{}') LIKE '%explicitly mention producer_name%'
        OR (value_json #>> '{}') LIKE '%явно упоминает producer_name%'
        THEN value_json #>> '{}'
      ELSE replace(
        value_json #>> '{}',
        '- Each post includes producer_name and producer_tag. producer_name can be a manufacturer, shop, or publishing source.',
        '- Each post includes producer_name and producer_tag. producer_name can be a manufacturer, shop, or publishing source.' || E'\n' ||
        '- The "text" field for every rewrite must explicitly mention producer_name at least once. Do not satisfy this only through producer_tag, hashtags, notes, or metadata.'
      )
    END
),
updated_at = NOW()
WHERE key = 'ai_writer_contract';
