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("PUSH_NOTIFICATION")
public class PushNotificationService implements MessagePushService {

    @Override
    public boolean sendAlarmMessage(SensorAlarm alarm/*, SensorAlarmUser user*/) {
        // 这里是模拟推送通知的实现，具体可以集成推送服务如 Firebase 或者其它
        String message = buildMessage(alarm);
        System.out.println("推送通知到: 内容: " + message);
        return false;
    }

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