package com.zcxk.charge.api.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 报警设置管理Vo
 *
 * @author lihui
 * @version V1.0
 * @date 2021/5/28
 **/
@Data
public class DataAlarmDetailsVo implements Serializable {

    @ApiModelProperty("报警详情ID")
    @ExcelIgnore
    private Long id;

    @ApiModelProperty("报警设置ID")
    @ExcelIgnore
    private Long manageId;

    @ApiModelProperty("报警名字")
    @ExcelProperty(value = {"名称"},index = 0)
    private String alarmName;

    @ApiModelProperty("报警设置规则")
    @ExcelProperty(value = {"报警详情"},index = 1)
    private String alarmSettingRules;

    @ApiModelProperty("报警开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    @ExcelProperty(value = {"开始时间"},index = 2)
    private Date alarmStartTime;

    @ApiModelProperty("报警结束时间")
    @ExcelProperty(value = {"结束时间"},index = 3)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date alarmEndTime;

    @ApiModelProperty("场景名字")
    @ExcelIgnore
    private String beSceneName;

    @ApiModelProperty("设备名字")
    @ExcelIgnore
    private String beDeviceName;

    @ApiModelProperty("参数名字")
    @ExcelIgnore
    private String beAttributeName;

    @ApiModelProperty("单位")
    @ExcelIgnore
    private String beUnit;

    @ApiModelProperty("经纬度X")
    @ExcelIgnore
    private BigDecimal bePointX;

    @ApiModelProperty("经纬度Y")
    @ExcelIgnore
    private BigDecimal bePointY;

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

    @ApiModelProperty("地址")
    @ExcelIgnore
    private String beAddress;

    @ApiModelProperty("对比场景名字")
    @ExcelIgnore
    private String toSceneName;

    @ApiModelProperty("对比设备名字")
    @ExcelIgnore
    private String toDeviceName;

    @ApiModelProperty("对比参数名字")
    @ExcelIgnore
    private String toAttributeName;

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

    @ApiModelProperty("对比单位")
    @ExcelIgnore
    private String toUnit;

    @ApiModelProperty("对比地址")
    @ExcelIgnore
    private String toAddress;

    @ApiModelProperty("对比经纬度X")
    @ExcelIgnore
    private BigDecimal toPointX;

    @ApiModelProperty("对比经纬度Y")
    @ExcelIgnore
    private BigDecimal toPointY;

    @ApiModelProperty
    @JsonIgnore
    @ExcelIgnore
    private String computeRules;

    @ApiModelProperty
    @JsonIgnore
    @ExcelIgnore
    private String alarmRules;

    @ApiModelProperty
    @JsonIgnore
    @ExcelIgnore
    private BigDecimal alarmValue;

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

    public String getAlarmSettingRules(){
        StringBuffer buf = new StringBuffer();
        buf.append(this.beSceneName).append(this.beDeviceName).append(this.beAttributeName)
                .append("(").append(this.beAlarmValue).append(this.beUnit).append(")")
                .append(this.computeRules).append(toSceneName).append(this.toDeviceName).append(this.toAttributeName)
                .append("(").append(this.toAlarmValue).append(this.toUnit).append(")")
                .append(this.alarmRules).append(this.alarmValue);
        return buf.toString();
    }

}
