-- Stufe pro politischem Amt (Tageshonorar: exponentielles Modell nach Stufe im Backend).
-- Entspricht Migration 20260403120000-political-office-hierarchy-level.cjs

ALTER TABLE falukant_type.political_office_type
  ADD COLUMN IF NOT EXISTS hierarchy_level INTEGER NOT NULL DEFAULT 1;

UPDATE falukant_type.political_office_type AS pot
SET hierarchy_level = sub.lvl
FROM (VALUES
  ('assessor', 1),
  ('councillor', 1),
  ('council', 2),
  ('beadle', 2),
  ('town-clerk', 2),
  ('mayor', 3),
  ('master-builder', 2),
  ('village-major', 2),
  ('judge', 3),
  ('bailif', 3),
  ('taxman', 2),
  ('sheriff', 3),
  ('consultant', 3),
  ('treasurer', 4),
  ('hangman', 2),
  ('territorial-council', 3),
  ('territorial-council-speaker', 4),
  ('ruler-consultant', 4),
  ('state-administrator', 4),
  ('super-state-administrator', 5),
  ('governor', 5),
  ('ministry-helper', 4),
  ('minister', 5),
  ('chancellor', 6)
) AS sub(name, lvl)
WHERE pot.name = sub.name;
