class InterviewApplicationInviteServiceImpl implements InterviewApplicationInviteService {

    @Override
    public ServiceResult<InterviewApplicationSentInviteResource> getSentInvite(long applicationId) {
        InterviewAssignment assignment = interviewAssignmentRepository.findOneByTargetId(applicationId);
        return ofNullable(assignment.getMessage())
                .map(message ->
                        serviceSuccess(
                                new InterviewApplicationSentInviteResource(message.getSubject(), message.getMessage(), message.getCreatedOn())
                        )
                )
                .orElse(serviceFailure(GENERAL_NOT_FOUND));
    }

}