package com.agri.system.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Builder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableName;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;

/**
 * 设备控制操作日志对象 sys_dev_oper_log
 * 
 * @author lld
 * @date 2026-01-29
 */
@TableName("sys_dev_oper_log")
public class SysDevOperLog extends BaseEntity
{
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** 大棚名称 */
    @Excel(name = "大棚名称")
    private String agriName;

    /** imei */
    @Excel(name = "imei")
    private String imei;

    /** 功能码 */
    @Excel(name = "功能码")
    private String funcCode;

    /** 操作类型 */
    @Excel(name = "操作类型")
    private Integer opType;

    /** 操作来源 */
    @Excel(name = "操作来源")
    private Integer opSource;

    /** 指令 */
    @Excel(name = "指令")
    private String payload;

    /** 是否成功获取锁 */
    @Excel(name = "是否成功获取锁")
    private Integer lockAcquired;

    /** 锁持有者 */
    @Excel(name = "锁持有者")
    private String lockHolder;

    /** 当前任务队列情况 */
    @Excel(name = "当前任务队列情况")
    private String taskStatus;

    /** 是否收到设备回执 */
    @Excel(name = "是否收到设备回执")
    private Integer ackReceived;

    /** 设备控制是否成功 */
    @Excel(name = "设备控制是否成功")
    private Integer ackSuc;

    /** 设备控制锁是否释放成功 */
    @Excel(name = "设备控制锁是否释放成功")
    private Integer isLockSuc;

    /** 是否触发定时任务 */
    @Excel(name = "是否触发定时任务")
    private Integer isTask;

    @Excel(name = "大棚运行时间限位")
    private Integer runTime;

    /** 未触发原因 */
    @Excel(name = "未触发原因")
    private String noTaskReason;

    /** 设备回执 */
    @Excel(name = "设备回执")
    private String ack;

    /** 自动关任务最终执行结果 */
    @Excel(name = "自动关任务最终执行结果")
    private Integer execResult;

    /** 未执行原因（如：锁占用、无最新状态、JSON异常） */
    @Excel(name = "未执行原因", readConverterExp = "如=：锁占用、无最新状态、JSON异常")
    private String skipReason;

    /** 执行前读取的状态快照 */
    @Excel(name = "执行前读取的状态快照")
    private String latestState;

    /** 乐观锁版本号 */
    @Version
    private Long version;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAgriName() {
        return agriName;
    }

    public void setAgriName(String agriName) {
        this.agriName = agriName;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public String getFuncCode() {
        return funcCode;
    }

    public void setFuncCode(String funcCode) {
        this.funcCode = funcCode;
    }

    public Integer getOpType() {
        return opType;
    }

    public void setOpType(Integer opType) {
        this.opType = opType;
    }

    public Integer getOpSource() {
        return opSource;
    }

    public void setOpSource(Integer opSource) {
        this.opSource = opSource;
    }

    public String getPayload() {
        return payload;
    }

    public void setPayload(String payload) {
        this.payload = payload;
    }

    public Integer getLockAcquired() {
        return lockAcquired;
    }

    public void setLockAcquired(Integer lockAcquired) {
        this.lockAcquired = lockAcquired;
    }

    public String getLockHolder() {
        return lockHolder;
    }

    public void setLockHolder(String lockHolder) {
        this.lockHolder = lockHolder;
    }

    public String getTaskStatus() {
        return taskStatus;
    }

    public void setTaskStatus(String taskStatus) {
        this.taskStatus = taskStatus;
    }

    public Integer getAckReceived() {
        return ackReceived;
    }

    public void setAckReceived(Integer ackReceived) {
        this.ackReceived = ackReceived;
    }

    public Integer getAckSuc() {
        return ackSuc;
    }

    public void setAckSuc(Integer ackSuc) {
        this.ackSuc = ackSuc;
    }

    public Integer getIsLockSuc() {
        return isLockSuc;
    }

    public void setIsLockSuc(Integer isLockSuc) {
        this.isLockSuc = isLockSuc;
    }

    public Integer getIsTask() {
        return isTask;
    }

    public void setIsTask(Integer isTask) {
        this.isTask = isTask;
    }

    public String getNoTaskReason() {
        return noTaskReason;
    }

    public void setNoTaskReason(String noTaskReason) {
        this.noTaskReason = noTaskReason;
    }

    public String getAck() {
        return ack;
    }

    public void setAck(String ack) {
        this.ack = ack;
    }

    public Integer getExecResult() {
        return execResult;
    }

    public void setExecResult(Integer execResult) {
        this.execResult = execResult;
    }

    public String getSkipReason() {
        return skipReason;
    }

    public void setSkipReason(String skipReason) {
        this.skipReason = skipReason;
    }


    public String getLatestState() {
        return latestState;
    }

    public void setLatestState(String latestState) {
        this.latestState = latestState;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    public Integer getRunTime() {
        return runTime;
    }

    public void setRunTime(Integer runTime) {
        this.runTime = runTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("agriName", getAgriName())
            .append("imei", getImei())
            .append("funcCode", getFuncCode())
            .append("opType", getOpType())
            .append("opSource", getOpSource())
            .append("payload", getPayload())
            .append("lockAcquired", getLockAcquired())
            .append("lockHolder", getLockHolder())
            .append("taskStatus", getTaskStatus())
            .append("ackReceived", getAckReceived())
            .append("ackSuc", getAckSuc())
            .append("isLockSuc", getIsLockSuc())
            .append("isTask", getIsTask())
            .append("runTime", getRunTime())
            .append("noTaskReason", getNoTaskReason())
            .append("ack", getAck())
            .append("execResult", getExecResult())
            .append("skipReason", getSkipReason())
            .append("latestState", getLatestState())
            .append("remark", getRemark())
            .append("version", getVersion())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
