package com.infoepoch.pms.agent.platform.agent.application.dto;

import com.infoepoch.pms.agent.platform.agent.domain.Agent;
import lombok.Getter;

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

/**
 * 智能体详情响应 DTO（含字段定义列表）。
 */
@Getter
public class AgentDetailResponse {

    private final String id;
    private final String name;
    private final String description;
    private final String systemPrompt;
    private final String submitUrl;
    private final String modelConfigId;
    private final boolean enabled;
    private final LocalDateTime createdAt;
    private final LocalDateTime updatedAt;
    private final List<AgentFieldResponse> fields;

    public AgentDetailResponse(Agent agent) {
        this.id = agent.getId();
        this.name = agent.getName();
        this.description = agent.getDescription();
        this.systemPrompt = agent.getSystemPrompt();
        this.submitUrl = agent.getSubmitUrl();
        this.modelConfigId = agent.getModelConfig() != null ? agent.getModelConfig().getId() : agent.getModelConfigId();
        this.enabled = agent.isEnabled();
        this.createdAt = agent.getCreatedAt();
        this.updatedAt = agent.getUpdatedAt();
        this.fields = agent.getFields().stream()
                .map(AgentFieldResponse::new)
                .toList();
    }
}
