package com.zcxk.charge.api.vo;

import com.zcxk.core.utils.encrypt.Md5;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 数据报警详情
 * @author lihui
 * @version V1.0
 * @date 2021/5/31
 **/
@Data
public class DataAlarmInfoVo {

    @ApiModelProperty(value = "场景ID")
    private Long beSceneId;

    @ApiModelProperty(value = "设备ID")
    private Long beDeviceId;

    @ApiModelProperty(value = "参数ID")
    private Long beAttributeId;

    @ApiModelProperty(value = "类型 :-> DataAlarmTypeEnum")
    private int beType;

    @ApiModelProperty(value = "计算规则")
    private String computeRules;

    @ApiModelProperty(value = "对比场景ID")
    private Long toSceneId;

    @ApiModelProperty(value = "对比设备ID")
    private Long toDeviceId;

    @ApiModelProperty(value = "对比参数ID")
    private Long toAttributeId;

    @ApiModelProperty(value = "对比类型 :-> DataAlarmTypeEnum")
    private int toType;

    @ApiModelProperty(value = "对比报警规则")
    private String alarmRules;

    @ApiModelProperty(value = "报警值")
    private BigDecimal alarmValue;

    @ApiModelProperty(value = "报警管理ID")
    private Long manageId;

    @ApiModelProperty(value = "名称")
    private String alarmName;

    @ApiModelProperty(value = "报警开始时间")
    private Date alarmStartTime;

    @ApiModelProperty(value = "报警结束时间")
    private Date alarmEndTime;

    @ApiModelProperty(value = "报警值")
    private BigDecimal beAlarmValue;

    @ApiModelProperty(value = "对比报警值")
    private BigDecimal toAlarmValue;

    @ApiModelProperty(value = "报警结果值")
    private BigDecimal resultAlarmValue;

    @ApiModelProperty(value = "历史数据：0不是，1是")
    private int isHistory;

    @ApiModelProperty(value = "是否被挂起：0不是，1是")
    private int isHangup;

    public String getMd5Query(){
        StringBuffer buffer = new StringBuffer();
        buffer.append(getBeSceneId()).append(getBeDeviceId()).append(getBeAttributeId())
                .append(getBeType()).append(getComputeRules()).append(getToSceneId()).append(getToDeviceId())
                .append(getToAttributeId()).append(getToType()).append(getAlarmRules()).append(getAlarmValue());
        return Md5.hash(buffer.toString());
    }
}
