public Mono<ServicePermission> isAllowedCreateGroupWithGroupType(
            @NotNull Long requesterId,
            @NotNull Long groupTypeId,
            @Nullable UserRole auxiliaryUserRole) {
        try {
            Validator.notNull(requesterId, "requesterId");
        } catch (ResponseException e) {
            return Mono.error(e);
        }
        return groupTypeService.groupTypeExists(groupTypeId)
                .flatMap(existed -> {
                    if (!existed) {
                        return Mono.just(ServicePermission
                                .get(ResponseStatusCode.CREATE_GROUP_WITH_NONEXISTENT_GROUP_TYPE));
                    }
                    Mono<UserRole> userRoleMono = auxiliaryUserRole != null
                            ? Mono.just(auxiliaryUserRole)
                            : userRoleService.queryStoredOrDefaultUserRoleByUserId(requesterId);
                    return userRoleMono.flatMap(userRole -> {
                        Set<Long> creatableGroupTypeIds = userRole.getCreatableGroupTypeIds();
                        if (!creatableGroupTypeIds.contains(groupTypeId)) {
                            List<Long> sortedIds = new ArrayList<>(creatableGroupTypeIds);
                            sortedIds.sort(null);
                            String ids = StringUtil.joinLatin1(", ", sortedIds);
                            String reason =
                                    "The requester is only allowed to create groups with the types: "
                                            + ids;
                            return Mono.just(ServicePermission.get(
                                    ResponseStatusCode.NO_PERMISSION_TO_CREATE_GROUP_WITH_GROUP_TYPE,
                                    reason));
                        }
                        Integer ownedGroupLimit = userRole.getGroupTypeIdToLimit()
                                .getOrDefault(groupTypeId,
                                        userRole.getOwnedGroupLimitForEachGroupType());
                        if (ownedGroupLimit == Integer.MAX_VALUE) {
                            return Mono.just(ServicePermission.OK);
                        }
                        return countOwnedGroups(requesterId, groupTypeId)
                                .map(ownedGroupCount -> ServicePermission
                                        .get(ownedGroupCount < ownedGroupLimit
                                                ? ResponseStatusCode.OK
                                                : ResponseStatusCode.MAX_OWNED_GROUPS_REACHED));
                    });
                });
    }
@implNote We don't need to check if the group count with the specified type owned by the
          requester exceeds here because it is implemented in
          {@link GroupService#isAllowedToCreateGroup}
turms-service/src/main/java/im/turms/service/domain/group/service/GroupService.java