export const RUN_VALIDATION_KINDS = [
    "build",
    "test",
    "lint",
    "format",
    "custom",
];
export const RUN_VALIDATION_VERDICTS = [
    "passed",
    "failed",
    "missing-evidence",
    "timed-out",
];
export const RUN_VALIDATION_REASON_CODES = [
    "runtime-validation-passed",
    "runtime-validation-failed",
    "runtime-validation-missing-evidence",
    "runtime-validation-timed-out",
];
export function isRunValidationKind(value) {
    return (typeof value === "string" &&
        RUN_VALIDATION_KINDS.includes(value));
}
export function isRunValidationVerdict(value) {
    return (typeof value === "string" &&
        RUN_VALIDATION_VERDICTS.includes(value));
}
export function reasonCodeForRunValidationVerdict(verdict) {
    switch (verdict) {
        case "passed":
            return "runtime-validation-passed";
        case "failed":
            return "runtime-validation-failed";
        case "missing-evidence":
            return "runtime-validation-missing-evidence";
        case "timed-out":
            return "runtime-validation-timed-out";
    }
}
export function runValidationOutcomeToEvidenceValidation(outcome) {
    if (outcome.verdict === "missing-evidence")
        return undefined;
    return {
        label: `${outcome.kind}:${outcome.command}`,
        status: outcome.verdict === "passed" ? "passed" : "failed",
        ...(typeof outcome.exitCode === "number"
            ? { exitCode: outcome.exitCode }
            : outcome.verdict === "timed-out"
                ? { exitCode: 124 }
                : {}),
        kind: outcome.kind,
        command: outcome.command,
        verdict: outcome.verdict,
        durationMs: outcome.durationMs,
        reasonCode: outcome.reasonCode,
    };
}
