package com.agent.management.engine;

import java.time.Instant;

/**
 * 节点执行过程中的一条日志记录
 */
public class ExecutionLog {

    public enum Type { INFO, TOOL_CALL, TOOL_RESULT, THINKING, ERROR }

    private final Type type;
    private final Instant timestamp;
    private final String message;
    private final String detail;  // 可选的额外信息（如工具参数、返回摘要）

    public ExecutionLog(Type type, String message, String detail) {
        this.type = type;
        this.timestamp = Instant.now();
        this.message = message;
        this.detail = detail;
    }

    public static ExecutionLog info(String message) {
        return new ExecutionLog(Type.INFO, message, null);
    }

    public static ExecutionLog toolCall(String toolName, String argsSummary) {
        return new ExecutionLog(Type.TOOL_CALL, toolName, argsSummary);
    }

    public static ExecutionLog toolResult(String toolName, String resultSummary) {
        return new ExecutionLog(Type.TOOL_RESULT, toolName, resultSummary);
    }

    public static ExecutionLog thinking(String text) {
        return new ExecutionLog(Type.THINKING, text, null);
    }

    public static ExecutionLog error(String message) {
        return new ExecutionLog(Type.ERROR, message, null);
    }

    public Type getType() { return type; }
    public Instant getTimestamp() { return timestamp; }
    public String getMessage() { return message; }
    public String getDetail() { return detail; }
}
