class ApplicationFundingDecisionServiceImpl implements ApplicationFundingDecisionService {

    @Override
    public ServiceResult<Void> saveApplicationFundingDecisionData(Long competitionId, FundingDecision fundingDecision, List<Long> applicationIds) {

        if (isAllowedFundingDecision(fundingDecision)) {
            Map<Long, FundingDecision> applicationIdToFundingDecision = applicationIds.stream().collect(toMap(Function.identity(), id -> fundingDecision));
            applicationFundingDecisionRestService.saveApplicationFundingDecisionData(competitionId, applicationIdToFundingDecision).getSuccess();
        } else {
            return serviceFailure(new Error("Disallowed funding decision submitted", HttpStatus.BAD_REQUEST));
        }
        return serviceSuccess();
    }

}