package vip.xiaonuo.coldchain.core.alarm.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import vip.xiaonuo.coldchain.modular.app.param.FloatNullToDashSerializer;
import vip.xiaonuo.coldchain.modular.monitortargetregion.entity.MonitorTargetRegion;

/**
 * @author jackzhou
 * @version 1.0
 * @project jfcloud-coldchain
 * @description
 * @date 2024/11/25 17:08:04
 */
@Data
public class SensorThreshold {
    /**
     * 温度报警上限 temperature humidity co2
     */
    @Schema(description = "温度报警上限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float temperatureUp;
    /**
     * 温度报警下限
     */
    @Schema(description = "温度报警下限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float temperatureDown;

    /**
     * 湿度报警上限 temperature humidity co2
     */

    @Schema(description = "湿度报警上限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float humidityUp;
    /**
     * 湿度报警下限
     */
    @Schema(description = "湿度报警下限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float humidityDown;

    /**
     * 二氧化碳报警上限 temperature humidity co2
     */
    @Schema(description = "二氧化碳报警上限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float co2Up;

    /**
     * 二氧化碳报警下限
     */
    @Schema(description = "二氧化碳报警下限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float co2Down;

    /**
     * 低电量报警下限
     */
    @Schema(description = "低电量报警下限")
    @JsonSerialize(using = FloatNullToDashSerializer.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float batteryDown;

    @Schema(description = "设备探头信息")
    @JsonIgnore
    private MonitorTargetRegion monitorTargetRegion;

    public SensorThreshold() {
    }

    public SensorThreshold(MonitorTargetRegion monitorTargetRegion) {
        this.monitorTargetRegion = monitorTargetRegion;
        this.co2Down = monitorTargetRegion.getCo2Down();
        this.co2Up = monitorTargetRegion.getCo2Up();
        this.humidityDown = monitorTargetRegion.getHumidityDown();
        this.humidityUp = monitorTargetRegion.getHumidityUp();
        this.temperatureDown = monitorTargetRegion.getTemperatureDown();
        this.temperatureUp = monitorTargetRegion.getTemperatureUp();
        this.batteryDown = monitorTargetRegion.getBatteryDown();
    }
}
