class CompetitionSetupServiceImpl implements CompetitionSetupService {

    @Override
    public ServiceResult<Void> deleteCompetition(long competitionId) {
        return competitionInviteRestService
                .getInviteStatistics(competitionId).toServiceResult().andOnSuccess(inviteStatistics -> {
                    if (inviteStatistics.getInvited() > 0 || inviteStatistics.getInviteList() > 0) {
                        return serviceFailure(COMPETITION_WITH_ASSESSORS_CANNOT_BE_DELETED);
                    } else {
                        return competitionSetupRestService.delete(competitionId).toServiceResult();
                    }
                });
    }

}