package infra

import (
	"fmt"
	"strings"
)

// JobStatus formats a map of status → count into a human-readable summary string.
// Example output: "pending: 5, running: 2, completed: 10, failed: 1, dead: 0"
// The output always includes all five canonical statuses in a fixed order.
// This is a pure function — no I/O, no state.
func JobStatusSummary(counts map[string]int) string {
	statuses := []string{"pending", "running", "completed", "failed", "dead"}
	parts := make([]string, 0, len(statuses))
	for _, s := range statuses {
		parts = append(parts, fmt.Sprintf("%s: %d", s, counts[s]))
	}
	return strings.Join(parts, ", ")
}
