package org.jk.rag.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * 审核节点类
 */
public class ApprovalNode {

    private Long id;
    private int nodeOrder;          // 节点顺序
    private String approver;      // 当前节点审核人
    private List<Long> chain;  // 审核人链

    public ApprovalNode(Long id, int nodeOrder, String approver, String chain) {
        this.id = id;
        this.nodeOrder = nodeOrder;
        this.approver = approver;
        this.chain = parseChain(chain);
    }

    // 解析审核人链字符串，如"5/6/7"
    private List<Long> parseChain(String chainStr) {
        String[] approverArray = chainStr.split("/");
        List<Long> chain = new ArrayList<>();
        for (String approver : approverArray) {
            chain.add(Long.parseLong(approver));
        }
        return chain;
    }

    // Getters
    public Long getId() { return id; }
    public int getNodeOrder() { return nodeOrder; }
    public String getApprover() { return approver; }
    public List<Long> getChain() { return chain; }
}
