package com.easyagents.flow.core.chain.repository;

import java.io.Serializable;
import java.util.Objects;

/**
 * 循环累计输出的轻量引用，避免完整列表回写到高频热状态。
 */
public final class LoopResultReference implements Serializable {

    private static final long serialVersionUID = 1L;
    private static final String REFERENCE_TYPE =
            "easyflow.loop-result.v1";

    private final String resultId;
    private final int iterationCount;
    private final String outputName;

    /**
     * 创建循环结果引用。
     *
     * @param resultId 循环结果 ID
     * @param iterationCount 迭代次数
     * @param outputName 输出名称
     */
    public LoopResultReference(String resultId, int iterationCount, String outputName) {
        this.resultId = Objects.requireNonNull(resultId, "resultId must not be null");
        this.iterationCount = iterationCount;
        this.outputName = Objects.requireNonNull(outputName, "outputName must not be null");
    }

    public String getResultId() {
        return resultId;
    }

    public int getIterationCount() {
        return iterationCount;
    }

    public String getOutputName() {
        return outputName;
    }

    /**
     * 获取跨异步审计边界使用的稳定引用类型。
     *
     * @return 引用类型
     */
    public String getReferenceType() {
        return REFERENCE_TYPE;
    }
}
