class InviteServiceImpl implements InviteService {

    @Override
    public List<ApplicationInviteResource> getPendingInvitationsByApplicationId(Long applicationId) {
        RestResult<List<InviteOrganisationResource>> pendingAssignableUsersResult = inviteRestService.getInvitesByApplication(applicationId);

        if(pendingAssignableUsersResult.isSuccess()){
            return pendingAssignableUsersResult.getSuccess()
                    .stream()
                    .flatMap(item -> item.getInviteResources().stream())
                    .filter(item -> !InviteStatus.OPENED.equals(item.getStatus()))
                    .collect(Collectors.toList());
        } else {
            return new ArrayList<>(0);
        }
    }

}