-- Seed platform settings for ITEM deal type + universal settlement-hold.
-- Uses INSERT ... ON CONFLICT DO UPDATE so it is idempotent.

INSERT INTO system_config (key, value, updated_at) VALUES
  ('item.handle_sla_max_business_days', '5',    now()),
  ('item.auto_confirm_days',            '2',    now()),
  ('item.refund_timeout_days',          '14',   now()),
  ('item.lost_threshold_days',          '21',   now()),
  ('item.return_window_min_days',       '14',   now()),
  ('settlement.hold_floor_days',        '14',   now()),
  ('settlement.payout_reserve_pct',     '5',    now()),
  ('address.zip_seed_dataset_url',
    '"https://data.gov.il/api/3/action/datastore_search?resource_id=a7296d1a-f8c9-4b70-96c7-a54a9f1a0b4c&limit=10000"',
    now()),
  ('address.zip_lazy_fetch_enabled',    'true', now())
ON CONFLICT (key) DO UPDATE
  SET value      = EXCLUDED.value,
      updated_at = EXCLUDED.updated_at;
