package com.pwt.netty.message2;

import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 *
 * 电池状态和实时信息
 */

@Getter
@Setter
public class BatteryStateInfo extends BaseData{

    /**
     * 电池仓Id
     */
    private String holderId;

    private String id;

    private String batterySn;

    public BatteryStateInfo(String holderId) {
        this.holderId = holderId;
    }

    public String getId() {
        return holderId;
    }

    /**
     * 状态 1 正常 2 故障
     */
    private int state = 1;


    /**
     * 当前SOC(最后返回的有效SOC)
     */
    private Double SOC;

    /**
     * 电池温度
     */
    private double batteryTemperature;

    /**
     * 电池电压
     */
    private double batteryVoltage;

    /**
     * 单体最低电压
     */
    private Double cellMinVoltage;

    /**
     * 单体最低电压编号
     */
    private Integer cellMinVoltageNum;

    /**
     * 单体最高电压
     */
    private Double cellMaxVoltage;

    /**
     * 单体最高电压编号
     */
    private Integer cellMaxVoltageNum;

    /**
     * 单体最低温度
     */
    private Double cellMinTemperature;

    /**
     * 单体最低温度编号
     */
    private Integer cellMinTemperatureNum;

    /**
     * 单体最高温度
     */
    private Double cellMaxTemperature;

    /**
     * 单体最高温度编号
     */
    private Integer cellMaxTemperatureNum;

    /**
     *
     */
    private Boolean isDelete;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BatteryStateInfo that = (BatteryStateInfo) o;
        return state == that.state && Double.compare(that.batteryTemperature, batteryTemperature) == 0 && Double.compare(that.batteryVoltage, batteryVoltage) == 0 && holderId.equals(that.holderId) && Objects.equals(id, that.id) && Objects.equals(batterySn, that.batterySn) && Objects.equals(SOC, that.SOC) && Objects.equals(cellMinVoltage, that.cellMinVoltage) && Objects.equals(cellMinVoltageNum, that.cellMinVoltageNum) && Objects.equals(cellMaxVoltage, that.cellMaxVoltage) && Objects.equals(cellMaxVoltageNum, that.cellMaxVoltageNum) && Objects.equals(cellMinTemperature, that.cellMinTemperature) && Objects.equals(cellMinTemperatureNum, that.cellMinTemperatureNum) && Objects.equals(cellMaxTemperature, that.cellMaxTemperature) && Objects.equals(cellMaxTemperatureNum, that.cellMaxTemperatureNum) && Objects.equals(isDelete, that.isDelete);
    }

    @Override
    public int hashCode() {
        return Objects.hash(holderId);
    }
}
