CREATE EXTENSION IF NOT EXISTS pgcrypto;

DO $$
BEGIN
  IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'role_type') THEN
    CREATE TYPE role_type AS ENUM ('admin','chair','member','secretary','advisor');
  END IF;
  IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'conf_level') THEN
    CREATE TYPE conf_level AS ENUM ('intern','vertraulich','streng_vertraulich');
  END IF;
  IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'scan_status_type') THEN
    CREATE TYPE scan_status_type AS ENUM ('pending','clean','infected','failed');
  END IF;
END$$;
