package com.inspect.alarminfo.domain;

import com.inspect.alarmdefect.domain.AlarmDefect;
import com.inspect.alarmdifferent.domain.AlarmDifferent;
import com.inspect.base.core.annotation.Excel;
import com.inspect.base.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;
import java.util.List;
import java.util.Objects;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@Setter
@Getter
public class AlarmInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;
    private Long lineId;
    @Excel(
            name = "告警图片产生间隔的标准命名"
    )
    private String bayName;
    @Excel(
            name = "告警图片产生设备的命名"
    )
    private String deviceName;
    @Excel(
            name = "告警图片产生的点位命名"
    )
    private String pointName;
    @JsonFormat(
            pattern = "yyyy-MM-dd"
    )
    @Excel(
            name = "表示告警时间",
            width = 30.0D,
            dateFormat = "yyyy-MM-dd"
    )
    private Date time;
    @Excel(
            name = "图片宽度"
    )
    private Long picWidth;
    @Excel(
            name = "图片高度"
    )
    private String picHeight;
    @Excel(
            name = "原图路径"
    )
    private String picRaw;
    @Excel(
            name = "判别告警图路径",
            readConverterExp = "可=选属性"
    )
    private String picDifferent;
    @Excel(
            name = "判别基准图路径",
            readConverterExp = "可=选属性"
    )
    private String picDiffBase;
    private List<AlarmDifferent> different;
    private List<AlarmDefect> defect;

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        AlarmInfo alarmInfo = (AlarmInfo) object;
        return Objects.equals(lineId, alarmInfo.lineId) && Objects.equals(bayName, alarmInfo.bayName) && Objects.equals(deviceName, alarmInfo.deviceName) && Objects.equals(pointName, alarmInfo.pointName) && Objects.equals(time, alarmInfo.time) && Objects.equals(picWidth, alarmInfo.picWidth) && Objects.equals(picHeight, alarmInfo.picHeight) && Objects.equals(picRaw, alarmInfo.picRaw) && Objects.equals(picDifferent, alarmInfo.picDifferent) && Objects.equals(picDiffBase, alarmInfo.picDiffBase) && Objects.equals(different, alarmInfo.different) && Objects.equals(defect, alarmInfo.defect);
    }

    @Override
    public int hashCode() {
        return Objects.hash(lineId, bayName, deviceName, pointName, time, picWidth, picHeight, picRaw, picDifferent, picDiffBase, different, defect);
    }

    @Override
    public String toString() {
        return "AlarmInfo{" +
                "lineId=" + lineId +
                ", bayName='" + bayName + '\'' +
                ", deviceName='" + deviceName + '\'' +
                ", pointName='" + pointName + '\'' +
                ", time=" + time +
                ", picWidth=" + picWidth +
                ", picHeight='" + picHeight + '\'' +
                ", picRaw='" + picRaw + '\'' +
                ", picDifferent='" + picDifferent + '\'' +
                ", picDiffBase='" + picDiffBase + '\'' +
                ", different=" + different +
                ", defect=" + defect +
                '}';
    }
}
