UPDATE ai_cost_policies
SET daily_limit_micro_eur = 10000000,
    monthly_limit_micro_eur = 100000000,
    updated_at = NOW()
WHERE scope_type = 'org'
  AND daily_limit_micro_eur = 2000000
  AND monthly_limit_micro_eur = 35000000;

UPDATE org_settings
SET settings = jsonb_set(
    jsonb_set(
        jsonb_set(
            jsonb_set(
                jsonb_set(
                    jsonb_set(
                        jsonb_set(
                            COALESCE(settings, '{}'::jsonb),
                            '{usage_quotas,llm_daily_cost_limit_eur}',
                            '10'::jsonb
                        ),
                        '{usage_quotas,llm_monthly_cost_limit_eur}',
                        '100'::jsonb
                    ),
                    '{usage_quotas,llm_requests_per_day}',
                    '100'::jsonb
                ),
                '{usage_quotas,llm_tokens_per_month}',
                '500000'::jsonb
            ),
            '{usage_quotas,search_requests_per_day}',
            '50'::jsonb
        ),
        '{usage_quotas,max_api_tokens_per_user}',
        '10'::jsonb
    ),
    '{usage_quotas,max_webhooks_per_user}',
    '20'::jsonb
),
updated_at = NOW()
WHERE id = 1
  AND COALESCE((settings->'usage_quotas'->>'llm_daily_cost_limit_eur')::numeric, 0) = 2
  AND COALESCE((settings->'usage_quotas'->>'llm_monthly_cost_limit_eur')::numeric, 0) = 35;
