// ---------------------------------------------------------------------------
// SDD phase weights for globalProgress (0-100)
// ---------------------------------------------------------------------------
const PHASE_WEIGHTS = {
    initializing: 0,
    analyzing: 5,
    'creating-spec': 20,
    filtering: 40,
    reviewing: 50,
    implementing: 70,
    validating: 85,
    documenting: 95,
    done: 100,
};
// ---------------------------------------------------------------------------
// Experience level formatting
// ---------------------------------------------------------------------------
/**
 * Format a message according to the user's experience level.
 * Beginner: conversational and guided.
 * Intermediate: concise technical summary.
 * Expert: data-only, zero hand-holding.
 */
export function formatByLevel(beginner, intermediate, expert, level) {
    switch (level) {
        case 'beginner':
            return beginner;
        case 'intermediate':
            return intermediate;
        case 'expert':
            return expert;
        /* v8 ignore next 2 */
        default:
            return intermediate;
    }
}
// ---------------------------------------------------------------------------
// Progress calculation
// ---------------------------------------------------------------------------
/** Compute globalProgress (0-100) from the current SDD phase. */
export function calcGlobalProgress(phase) {
    return PHASE_WEIGHTS[phase];
}
// ---------------------------------------------------------------------------
// PhaseEvent factories
// ---------------------------------------------------------------------------
/**
 * Create a fully-specified PhaseEvent.
 */
export function createPhaseEvent(params) {
    return {
        phase: params.phase,
        action: params.action,
        status: params.status,
        message: params.message,
        detail: params.detail,
        progress: params.progress,
        globalProgress: params.globalProgress ?? calcGlobalProgress(params.phase),
        timestamp: new Date().toISOString(),
    };
}
/**
 * Create a minimal PhaseEvent suitable for any tool handler.
 */
export function createBasicPhaseEvent(tool, status, progress, phase = 'analyzing') {
    return createPhaseEvent({ phase, action: tool, status, message: `${tool}: ${status}`, progress });
}
// ---------------------------------------------------------------------------
// PhaseTracker factory
// ---------------------------------------------------------------------------
/**
 * Create a PhaseTracker with sensible defaults.
 */
export function createPhaseTracker(params) {
    return {
        currentPhase: params.currentPhase,
        specId: params.specId,
        stepDescription: params.stepDescription,
        progress: params.progress,
        globalProgress: calcGlobalProgress(params.currentPhase),
        stepsCompleted: params.stepsCompleted ?? [],
        nextStep: params.nextStep,
        blockers: params.blockers ?? [],
        elapsedSeconds: 0,
        estimatedRemainingSeconds: 0,
        experienceLevel: params.experienceLevel ?? 'intermediate',
    };
}
//# sourceMappingURL=phase-tracker.js.map