class MailProjectApplicationEventHandler implements ProjectApplicationEventHandler {

    @Override
    public void onApplicationReceived(ProjectApplication application) {
        var applicant = application.getUser();
        var manager = userService.getManagerOfUser(applicant);
        var applicantData = userService.getUserData(applicant);
        var managerData = userService.getUserData(manager);
        var issueLink = referralBaseUrl + application.getProject().getId();

        var contextMap = Map.of(
            "projectApplication", application,
            "applicantData", applicantData,
                "managerData", managerData,
                "issueLink", issueLink
        );
        var subjectTextPair = velocityMailTemplateService.getSubjectAndText("/templates/mail/UserAppliedForProject.vm", contextMap);

        var simpleMessage = new SimpleMessage(applicant, manager, subjectTextPair.getFirst(), subjectTextPair.getSecond());
        mailSenderAdapter.queueMessage(simpleMessage);
    }

    public  MailProjectApplicationEventHandler(MailSenderAdapter mailSenderAdapter,
                                              UserService userService,
                                              VelocityMailTemplateService velocityMailTemplateService,
                                              MailConfigurationProperties mailConfigProperties);

}