package com.cameleer.server.core.detail;

import java.time.Instant;
import java.util.List;
import java.util.Map;

/**
 * Full detail of a route execution, including the nested processor tree.
 * <p>
 * This is the rich detail model returned by the detail endpoint. The processor
 * tree is reconstructed from individual processor records stored in PostgreSQL.
 *
 * @param executionId        unique execution identifier
 * @param routeId            Camel route ID
 * @param instanceId         agent instance that reported the execution
 * @param environment        environment slug this exchange was recorded in
 * @param status             execution status (COMPLETED, FAILED, RUNNING)
 * @param startTime          execution start time
 * @param endTime            execution end time (may be null for RUNNING)
 * @param durationMs         execution duration in milliseconds
 * @param correlationId      correlation ID for cross-instance tracing
 * @param exchangeId         Camel exchange ID
 * @param errorMessage       error message (empty string if no error)
 * @param errorStackTrace    error stack trace (empty string if no error)
 * @param diagramContentHash content hash linking to the active route diagram version
 * @param processors         nested processor execution tree (root nodes)
 * @param inputBody          exchange input body at route entry (null if not captured)
 * @param outputBody         exchange output body at route exit (null if not captured)
 * @param inputHeaders       exchange input headers at route entry (null if not captured)
 * @param outputHeaders      exchange output headers at route exit (null if not captured)
 */
public record ExecutionDetail(
        String executionId,
        String routeId,
        String instanceId,
        String applicationId,
        String environment,
        String status,
        Instant startTime,
        Instant endTime,
        long durationMs,
        String correlationId,
        String exchangeId,
        String errorMessage,
        String errorStackTrace,
        String diagramContentHash,
        List<ProcessorNode> processors,
        String inputBody,
        String outputBody,
        String inputHeaders,
        String outputHeaders,
        String inputProperties,
        String outputProperties,
        Map<String, String> attributes,
        String errorType,
        String errorCategory,
        String rootCauseType,
        String rootCauseMessage,
        String traceId,
        String spanId
) {
}
