package cn.com.oa.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 车辆进出识别记录表
 * @TableName car_inout_record
 */
@TableName(value ="car_inout_record")
@Data
public class CarInoutRecord implements Serializable {
    /**
     * 主键，自增ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 识别设备的IP地址
     */
    private String deviceIp;

    /**
     * 设备的序列号
     */
    private String serialNo;

    /**
     * 识别到的车牌号码
     */
    private String licensePlate;

    /**
     * 车牌识别的置信度（0-100）
     */
    private Integer plateConfidence;

    /**
     * 是否是真实车牌（true表示是真实车牌）
     */
    private Boolean realPlate;

    /**
     * 车牌颜色类型（如1-蓝、2-黄、3-白、4-黑、5-绿、6-黄绿、7-白绿、99-其他）
     */
    private Integer plateColorType;

    /**
     * 识别方式（如地感触发、雷达、视频等）
     */
    private Integer triggerType;

    /**
     * 车辆行驶方向（0-未知，1-进，2-出）
     */
    private Integer direction;

    /**
     * 车辆识别ID，用于车辆唯一标识
     */
    private Long vehicleId;

    /**
     * 白名单类型（0-无，1-临时车，2-免费车）
     */
    private Integer whitelistType;

    /**
     * 识别时间戳（秒）
     */
    private LocalDateTime timeStamp;

    /**
     * 记录创建时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CarInoutRecord other = (CarInoutRecord) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDeviceIp() == null ? other.getDeviceIp() == null : this.getDeviceIp().equals(other.getDeviceIp()))
            && (this.getSerialNo() == null ? other.getSerialNo() == null : this.getSerialNo().equals(other.getSerialNo()))
            && (this.getLicensePlate() == null ? other.getLicensePlate() == null : this.getLicensePlate().equals(other.getLicensePlate()))
            && (this.getPlateConfidence() == null ? other.getPlateConfidence() == null : this.getPlateConfidence().equals(other.getPlateConfidence()))
            && (this.getRealPlate() == null ? other.getRealPlate() == null : this.getRealPlate().equals(other.getRealPlate()))
            && (this.getPlateColorType() == null ? other.getPlateColorType() == null : this.getPlateColorType().equals(other.getPlateColorType()))
            && (this.getTriggerType() == null ? other.getTriggerType() == null : this.getTriggerType().equals(other.getTriggerType()))
            && (this.getDirection() == null ? other.getDirection() == null : this.getDirection().equals(other.getDirection()))
            && (this.getVehicleId() == null ? other.getVehicleId() == null : this.getVehicleId().equals(other.getVehicleId()))
            && (this.getWhitelistType() == null ? other.getWhitelistType() == null : this.getWhitelistType().equals(other.getWhitelistType()))
            && (this.getTimeStamp() == null ? other.getTimeStamp() == null : this.getTimeStamp().equals(other.getTimeStamp()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDeviceIp() == null) ? 0 : getDeviceIp().hashCode());
        result = prime * result + ((getSerialNo() == null) ? 0 : getSerialNo().hashCode());
        result = prime * result + ((getLicensePlate() == null) ? 0 : getLicensePlate().hashCode());
        result = prime * result + ((getPlateConfidence() == null) ? 0 : getPlateConfidence().hashCode());
        result = prime * result + ((getRealPlate() == null) ? 0 : getRealPlate().hashCode());
        result = prime * result + ((getPlateColorType() == null) ? 0 : getPlateColorType().hashCode());
        result = prime * result + ((getTriggerType() == null) ? 0 : getTriggerType().hashCode());
        result = prime * result + ((getDirection() == null) ? 0 : getDirection().hashCode());
        result = prime * result + ((getVehicleId() == null) ? 0 : getVehicleId().hashCode());
        result = prime * result + ((getWhitelistType() == null) ? 0 : getWhitelistType().hashCode());
        result = prime * result + ((getTimeStamp() == null) ? 0 : getTimeStamp().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", deviceIp=").append(deviceIp);
        sb.append(", serialNo=").append(serialNo);
        sb.append(", licensePlate=").append(licensePlate);
        sb.append(", plateConfidence=").append(plateConfidence);
        sb.append(", realPlate=").append(realPlate);
        sb.append(", plateColorType=").append(plateColorType);
        sb.append(", triggerType=").append(triggerType);
        sb.append(", direction=").append(direction);
        sb.append(", vehicleId=").append(vehicleId);
        sb.append(", whitelistType=").append(whitelistType);
        sb.append(", timeStamp=").append(timeStamp);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}