private Map<DeviceType, Set<DeviceType>> newExclusiveDeviceFromStrategy(
            SimultaneousLoginStrategy strategy) {
        Map<DeviceType, Set<DeviceType>> newDeviceTypeToExclusiveDeviceTypes = CollectionUtil
                .newMapWithExpectedSize(DeviceTypeUtil.ALL_AVAILABLE_DEVICE_TYPES.length);
        for (DeviceType deviceType : DeviceTypeUtil.ALL_AVAILABLE_DEVICE_TYPES) {
            // Every device type conflicts with itself
            newDeviceTypeToExclusiveDeviceTypes
                    .computeIfAbsent(deviceType,
                            key -> CollectionUtil.newSetWithExpectedSize(
                                    DeviceTypeUtil.ALL_AVAILABLE_DEVICE_TYPES.length))
                    .add(deviceType);
        }
        switch (strategy) {
            case ALLOW_ONE_DEVICE_OF_EACH_DEVICE_TYPE_ONLINE -> {
            }
            case ALLOW_ONE_DEVICE_FOR_ALL_DEVICE_TYPES_ONLINE -> {
                for (DeviceType type : DeviceTypeUtil.ALL_AVAILABLE_DEVICE_TYPES) {
                    addDeviceTypeConflictedWithAllTypes(newDeviceTypeToExclusiveDeviceTypes, type);
                }
            }
            case ALLOW_ONE_DEVICE_OF_DESKTOP_AND_ONE_DEVICE_OF_MOBILE_ONLINE,
                    ALLOW_ONE_DEVICE_OF_DESKTOP_AND_ONE_DEVICE_OF_BROWSER_AND_ONE_DEVICE_OF_MOBILE_ONLINE -> {
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.ANDROID,
                        DeviceType.IOS);
            }
            case ALLOW_ONE_DEVICE_OF_DESKTOP_OR_BROWSER_AND_ONE_DEVICE_OF_MOBILE_ONLINE -> {
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.DESKTOP,
                        DeviceType.BROWSER);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.ANDROID,
                        DeviceType.IOS);
            }
            case ALLOW_ONE_DEVICE_OF_DESKTOP_OR_MOBILE_ONLINE -> {
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.DESKTOP,
                        DeviceType.ANDROID);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.DESKTOP,
                        DeviceType.IOS);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.ANDROID,
                        DeviceType.IOS);
            }
            case ALLOW_ONE_DEVICE_OF_DESKTOP_OR_BROWSER_OR_MOBILE_ONLINE -> {
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.DESKTOP,
                        DeviceType.BROWSER);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.DESKTOP,
                        DeviceType.ANDROID);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.DESKTOP,
                        DeviceType.IOS);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.BROWSER,
                        DeviceType.ANDROID);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.BROWSER,
                        DeviceType.IOS);
                addConflictedDeviceTypes(newDeviceTypeToExclusiveDeviceTypes,
                        DeviceType.ANDROID,
                        DeviceType.IOS);
            }
            default -> throw new IncompatibleInternalChangeException(
                    "Unexpected simultaneous login strategy: "
                            + strategy);
        }
        return Map.copyOf(
                CollectionUtil.transformValues(newDeviceTypeToExclusiveDeviceTypes, Set::copyOf));
    }
Forbidden device types can never connect to turms servers
turms-gateway/src/main/java/im/turms/gateway/domain/session/service/UserSimultaneousLoginService.java