package com.yupi.project.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.yupi.project.model.enums.CommandTypeEnum;
import com.yupi.project.model.enums.RobotTaskStatusEnum;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;

/**
 * 机器人指令任务表实体
 */
@TableName(value ="robot_task")
@Data
public class RobotTask implements Serializable {

    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("robot_id")
    private String robotId;

    // Store enum as String in DB, but handle as Enum in Java
    // Consider using MyBatis-Plus EnumTypeHandler.VARCHAR if direct mapping is problematic,
    // or ensure the String value from the enum is used for persistence.
    @TableField("command_type")
    private CommandTypeEnum commandType;

    @TableField("command_payload")
    private String commandPayload;

    // Store enum as String in DB
    @TableField("status")
    private RobotTaskStatusEnum status;

    @TableField("sent_time")
    private Date sentTime;

    @TableField("ack_time")
    private Date ackTime;

    @TableField("related_session_id")
    private Long relatedSessionId; // 关联的充电会话ID (对应数据库表中的related_session_id)

    @TableField("error_message")
    private String errorMessage;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @TableLogic // If soft delete is desired, though not specified in DDL
    @TableField(value = "is_delete", select = false) // By default, don't select the delete flag unless explicitly queried
    private Integer isDelete; // Common practice for @TableLogic

    private static final long serialVersionUID = 1L;
} 