package com.sundot.airport.system.domain.approval;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

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 com.fasterxml.jackson.annotation.JsonFormat;
import com.sundot.airport.common.annotation.Excel;
import com.sundot.airport.common.core.domain.BaseEntity;

/**
 * 审批历史对象 approval_history
 *
 * @author simon lin
 * @date 2025-09-06
 */
@TableName("approval_history")
public class ApprovalHistory extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 实例ID
     */
    @Excel(name = "实例ID")
    @NotNull(message = "实例ID不能为空")
    private Long instanceId;

    /**
     * 任务ID
     */
    @Excel(name = "任务ID")
    private Long taskId;

    /**
     * 节点ID
     */
    @Excel(name = "节点ID")
    private Long nodeId;

    /**
     * 节点名称
     */
    @Excel(name = "节点名称")
    @Size(min = 0, max = 100, message = "节点名称长度不能超过100个字符")
    private String nodeName;

    /**
     * 操作(SUBMIT:提交,APPROVE:同意,REJECT:驳回,CANCEL:取消,COMPLETE:完成)
     */
    @Excel(name = "操作")
    @NotBlank(message = "操作不能为空")
    @Size(min = 0, max = 50, message = "操作长度不能超过50个字符")
    private String action;

    /**
     * 操作人ID
     */
    @Excel(name = "操作人ID")
    @NotNull(message = "操作人ID不能为空")
    private Long operatorId;

    /**
     * 操作人姓名
     */
    @Excel(name = "操作人姓名")
    @NotBlank(message = "操作人姓名不能为空")
    @Size(min = 0, max = 50, message = "操作人姓名长度不能超过50个字符")
    private String operatorName;

    /**
     * 操作时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date operationTime;

    /**
     * 操作意见
     */
    @Excel(name = "操作意见")
    private String comment;

    /**
     * 表单数据
     */
    @Excel(name = "表单数据")
    private String formData;

    /**
     * 审批实例
     */
    @TableField(exist = false)
    private ApprovalInstance instance;

    /**
     * 节点定义
     */
    @TableField(exist = false)
    private ApprovalNodeDefinition nodeDefinition;

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

    public Long getId() {
        return id;
    }

    public void setInstanceId(Long instanceId) {
        this.instanceId = instanceId;
    }

    public Long getInstanceId() {
        return instanceId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    public Long getTaskId() {
        return taskId;
    }

    public void setNodeId(Long nodeId) {
        this.nodeId = nodeId;
    }

    public Long getNodeId() {
        return nodeId;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getAction() {
        return action;
    }

    public void setOperatorId(Long operatorId) {
        this.operatorId = operatorId;
    }

    public Long getOperatorId() {
        return operatorId;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperationTime(Date operationTime) {
        this.operationTime = operationTime;
    }

    public Date getOperationTime() {
        return operationTime;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getComment() {
        return comment;
    }

    public void setFormData(String formData) {
        this.formData = formData;
    }

    public String getFormData() {
        return formData;
    }

    public ApprovalInstance getInstance() {
        return instance;
    }

    public void setInstance(ApprovalInstance instance) {
        this.instance = instance;
    }

    public ApprovalNodeDefinition getNodeDefinition() {
        return nodeDefinition;
    }

    public void setNodeDefinition(ApprovalNodeDefinition nodeDefinition) {
        this.nodeDefinition = nodeDefinition;
    }

    @Override
    public String toString() {
        return "ApprovalHistory{" +
                "id=" + id +
                ", instanceId=" + instanceId +
                ", taskId=" + taskId +
                ", nodeId=" + nodeId +
                ", nodeName='" + nodeName + '\'' +
                ", action='" + action + '\'' +
                ", operatorId=" + operatorId +
                ", operatorName='" + operatorName + '\'' +
                ", operationTime=" + operationTime +
                '}';
    }
}