class ApplicationNotificationTemplateServiceImpl extends BaseTransactionalService implements ApplicationNotificationTemplateService {

    @Override
    public ServiceResult<ApplicationNotificationTemplateResource> getUnsuccessfulNotificationTemplate(long competitionId) {

        return getCompetition(competitionId).andOnSuccess(competition -> {
            String unsuccessfulTemplate = competition.isKtp() ?
                    "unsuccessful_funding_decision_ktp.html" : "unsuccessful_funding_decision.html";

            return renderTemplate(competitionId, unsuccessfulTemplate, (c) -> {
                Map<String, Object> arguments = new HashMap<>();
                arguments.put("competitionName", c.getName());
                arguments.put("dashboardUrl", webBaseUrl);
                arguments.put("feedbackDate", toUkTimeZone(c.getReleaseFeedbackDate()).format(formatter));
                arguments.put("competitionId", c.getId());
                return arguments;
            });
        });
    }

}