/**
 * Pure view-model derivations for the **business-user Predictions catalog** — the home surface that
 * reframes published ML models as plain-language "predictions" a non-technical Outcome Owner can browse,
 * trust, and act on. Each published model becomes a catalog card carrying the shared trust verdict
 * (the SAME `deriveTrustVerdict` rule the agent's publish gate uses), so a Poor / unmeasured model is
 * visibly flagged and blocked from being opened — never silently presented as usable.
 *
 * Framework-free + deterministic (like `predictive-studio.view-models.ts`) → unit-tested with no Angular.
 */
import { deriveTrustVerdict } from '@memberjunction/predictive-studio-core';
/** Map a published model into a business catalog card, applying the trust gate. */
export function toBusinessPredictionCard(input) {
    const trust = deriveTrustVerdict(input);
    return {
        modelId: input.modelId,
        title: input.name?.trim() || 'Untitled prediction',
        trust,
        canOpen: trust.canAct,
        blockedReason: trust.canAct
            ? null
            : trust.unknown
                ? 'Not measured yet — an analyst needs to validate it.'
                : 'Needs an analyst — not reliable enough to use yet.',
        updatedAt: input.updatedAt ?? null,
    };
}
const GRADE_ORDER = { Excellent: 0, Good: 1, Fair: 2, Poor: 3 };
/** Build the business catalog from published models, most-trustworthy first (Poor/blocked sinks to the bottom). */
export function buildBusinessCatalog(inputs) {
    return inputs.map(toBusinessPredictionCard).sort((a, b) => GRADE_ORDER[a.trust.grade] - GRADE_ORDER[b.trust.grade]);
}
//# sourceMappingURL=business-predictions.view-models.js.map