package com.yaoai.api.dto.agent;

import com.yaoai.domain.entity.GraphRun;
import com.yaoai.domain.entity.GraphStep;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
public class AgentRunDTO {
    private Long id;
    private Long projectId;
    private String goal;
    private String status;
    private LocalDateTime createdAt;
    private List<AgentStepDTO> steps;

    public static AgentRunDTO from(GraphRun run, List<GraphStep> steps) {
        AgentRunDTO dto = new AgentRunDTO();
        dto.setId(run.getId());
        dto.setProjectId(run.getProjectId());
        dto.setGoal(run.getGoal());
        dto.setStatus(run.getStatus());
        dto.setCreatedAt(run.getCreatedAt());
        dto.setSteps(steps.stream().map(AgentStepDTO::from).toList());
        return dto;
    }
}
