export const DEFAULT_FIT_THRESHOLDS = { needsConfirmation: 0.45, ready: 0.72 };
const LABELS = {
    ready: 'ready',
    needs_confirmation: 'needs confirmation',
    insufficient: 'insufficient',
};
export function fitStatusFromScore(score, t) {
    if (score >= t.ready)
        return 'ready';
    if (score >= t.needsConfirmation)
        return 'needs_confirmation';
    return 'insufficient';
}
export function fitMeterVM(input) {
    const thresholds = input.thresholds ?? DEFAULT_FIT_THRESHOLDS;
    const percent = Math.max(0, Math.min(100, input.score * 100));
    const status = input.status && LABELS[input.status]
        ? input.status
        : fitStatusFromScore(input.score, thresholds);
    return { percent, status, label: LABELS[status], thresholds, missing: input.missing ?? [] };
}
