package io.wdd.server.beans.po;

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 java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName execution_log
 */
@TableName(value ="execution_log")
@Data
public class ExecutionLogPO implements Serializable {
    /**
     * 
     */
    @TableId
    private Long id;

    /**
     * 
     */
    private String agentTopicName;

    /**
     * 
     */
    private String resultKey;

    /**
     * 
     */
    private LocalDateTime acTime;

    /**
     * 
     */
    private Integer resultCode;

    /**
     * 执行类型，命令行或者Function
     */
    private String type;

    /**
     * 
     */
    private String commandList;

    /**
     * 命令执行结果
     */
    private String resultContent;

    /**
     * redis stream key中任务结果对应的RecordId
     */
    private String recordId;

    @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;
        }
        ExecutionLogPO other = (ExecutionLogPO) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getAgentTopicName() == null ? other.getAgentTopicName() == null : this.getAgentTopicName().equals(other.getAgentTopicName()))
            && (this.getResultKey() == null ? other.getResultKey() == null : this.getResultKey().equals(other.getResultKey()))
            && (this.getAcTime() == null ? other.getAcTime() == null : this.getAcTime().equals(other.getAcTime()))
            && (this.getResultCode() == null ? other.getResultCode() == null : this.getResultCode().equals(other.getResultCode()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getCommandList() == null ? other.getCommandList() == null : this.getCommandList().equals(other.getCommandList()))
            && (this.getResultContent() == null ? other.getResultContent() == null : this.getResultContent().equals(other.getResultContent()))
            && (this.getRecordId() == null ? other.getRecordId() == null : this.getRecordId().equals(other.getRecordId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getAgentTopicName() == null) ? 0 : getAgentTopicName().hashCode());
        result = prime * result + ((getResultKey() == null) ? 0 : getResultKey().hashCode());
        result = prime * result + ((getAcTime() == null) ? 0 : getAcTime().hashCode());
        result = prime * result + ((getResultCode() == null) ? 0 : getResultCode().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getCommandList() == null) ? 0 : getCommandList().hashCode());
        result = prime * result + ((getResultContent() == null) ? 0 : getResultContent().hashCode());
        result = prime * result + ((getRecordId() == null) ? 0 : getRecordId().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(", agentTopicName=").append(agentTopicName);
        sb.append(", resultKey=").append(resultKey);
        sb.append(", acTime=").append(acTime);
        sb.append(", resultCode=").append(resultCode);
        sb.append(", type=").append(type);
        sb.append(", commandList=").append(commandList);
        sb.append(", resultContent=").append(resultContent);
        sb.append(", recordId=").append(recordId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}