class MailUserAccessEventHandler implements UserAccessEventHandler {

    @Override
    public void onAccessChanged(User user, AccessInterval accessInterval, LocalDateTime previousEndTime) {
        if(!accessInterval.getEndTime().equals(previousEndTime)) {
            var contextMap = getContextMap(user, accessInterval.getEndTime());
            var templatePath = getTemplatePathAccessChanged(accessInterval.getEndTime(), previousEndTime);

            var subjectTextPair = velocityMailTemplateService.getSubjectAndText(templatePath, contextMap);
            var message = new TimeAwareMessage(user, user, subjectTextPair.getFirst(),
                    subjectTextPair.getSecond(), accessInterval.getEndTime());
            mailSenderAdapter.queueMessage(message);
        }
    }

    public  MailUserAccessEventHandler(MailSenderAdapter mailSenderAdapter,
                                      UserService userService,
                                      VelocityMailTemplateService velocityMailTemplateService,
                                      ProjectBoardConfigurationProperties configurationProperties);

}