/**
* 예약 확인 이메일 전송
*
* @param appointment
*/
private void sendAppointmentConfirmation(Appointment appointment) {
User studentUser = appointment.getStudent().getUser(); // 학생의 사용자 정보 가져오기
String formattedTime = appointment.getStartTime().format(FORMATTER); // 예약 시간 포맷팅
// 학생에게 이메일 전송
Map<String, Object> studentVars = new HashMap<>(); // 변수 맵 생성
studentVars.put("studentName", studentUser.getName()); // 학생 이름
studentVars.put("teacherName", appointment.getTeacher().getUser().getName()); // 교사 이름
studentVars.put("appointmentTime", formattedTime); // 예약 시간
studentVars.put("meetingLink", appointment.getMeetingLink()); // 미팅 링크
studentVars.put("consultationTitle", appointment.getConsultationTitle()); // 상담 제목
studentVars.put("isVirtual", true); // 가상 상담 여부
NotificationDto studentNotification = NotificationDto.builder()
.recipient(studentUser.getEmail())
.subject("A!INHA EDU 상담 예약 확인: " + appointment.getConsultationTitle())
.templateName("student-appointment")
.templateVariables(studentVars)
.build();
notificationService.sendEmail(studentNotification, studentUser);
log.info("학생 {}에게 예약 확인 이메일 전송 완료.", studentUser.getEmail());
// 교사에게 이메일 전송
User teacherUser = appointment.getTeacher().getUser(); // 교사의 사용자 정보 가져오기
Map<String, Object> teacherVars = new HashMap<>(); // 변수 맵 생성
teacherVars.put("teacherName", teacherUser.getName()); // 교사 이름
teacherVars.put("studentName", appointment.getStudent().getUser().getName()); // 학생 이름
teacherVars.put("appointmentTime", formattedTime); // 예약 시간
teacherVars.put("meetingLink", appointment.getMeetingLink()); // 미팅 링크
teacherVars.put("consultationTitle", appointment.getConsultationTitle()); // 상담 제목
teacherVars.put("consultationPurpose", appointment.getConsultationPurpose().toString()); // 상담 목적
teacherVars.put("isVirtual", true); // 가상 상담 여부
NotificationDto teacherNotification = NotificationDto.builder()
.recipient(teacherUser.getEmail())
.subject("A!INHA EDU 상담 예약 확인: " + appointment.getConsultationTitle())
.templateName("teacher-appointment")
.templateVariables(teacherVars)
.build();
notificationService.sendEmail(teacherNotification, teacherUser);
log.info("교사 {}에게 예약 확인 이메일 전송 완료.", teacherUser.getEmail());
}