+
+ public record RegisteredUser(Optional<ACI> aci, Optional<PNI> pni) {
+
+ public RegisteredUser {
+ aci = aci.isPresent() && aci.get().equals(ServiceId.UNKNOWN) ? Optional.empty() : aci;
+ pni = pni.isPresent() && pni.get().equals(ServiceId.UNKNOWN) ? Optional.empty() : pni;
+ if (aci.isEmpty() && pni.isEmpty()) {
+ throw new AssertionError("Must have either a ACI or PNI!");
+ }
+ }
+
+ public ServiceId getServiceId() {
+ return aci.map(a -> (ServiceId) a).or(this::pni).orElse(null);
+ }
+ }