package com.agent.management.model.entity;

import jakarta.persistence.*;
import lombok.Data;

/**
 * 工作流单次执行中某个节点的结果
 */
@Data
@Entity
@Table(name = "workflow_run_node")
public class WorkflowRunNode {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "run_id", nullable = false)
    private Long runId;

    @Column(name = "node_id", nullable = false)
    private String nodeId;

    @Column(name = "node_type")
    private String nodeType;

    private String label;

    /** RUNNING, SUCCESS, FAILED, SKIPPED */
    @Column(nullable = false)
    private String status;

    /** 输出变量 JSON */
    @Column(columnDefinition = "TEXT")
    private String output;

    private String error;

    @Column(name = "selected_branch")
    private String selectedBranch;

    /** 执行日志 JSON */
    @Column(columnDefinition = "TEXT")
    private String logs;

    /** 节点执行后的完整 variables 快照 JSON（debug 视图与运行历史回放） */
    @Column(name = "context_snapshot", columnDefinition = "TEXT")
    private String contextSnapshot;

    /** 节点执行顺序 */
    @Column(name = "sort_order")
    private Integer sortOrder;
}
