package vip.xiaonuo.coldchain.core.alarm.service.messagepush.impl;

import org.springframework.stereotype.Service;
import vip.xiaonuo.coldchain.core.alarm.bean.SensorAlarm;
import vip.xiaonuo.coldchain.core.alarm.service.messagepush.MessagePushService;

/**
 * @author jackzhou
 * @version 1.0
 * @project jfcloud-coldchain
 * @description 邮件推送实现类
 * @date 2024/11/26
 */
@Service("EMAIL")
public class EmailPushService implements MessagePushService {

    @Override
    public boolean sendAlarmMessage(SensorAlarm alarm/*, SensorAlarmUser user*/) {
        // 这里是模拟发送邮件的实现，具体可以集成第三方邮件服务
        String message = buildMessage(alarm);
        System.out.println("发送邮件到:  内容: " + message);
        return false;
    }

    private String buildMessage(SensorAlarm alarm) {
        return "告警信息：设备 " + alarm.getDeviceName() + " " + alarm.getMessage();
    }
}
