/**
 * Consumer-verification schemas. `ConsumerVerificationVerdictSchema` is the
 * trust boundary for the consumer's verifier module — verdicts are parsed
 * before use. All three `satisfies` their domain types, so drift is a
 * build error.
 */
import { z } from "zod";
const NotApplicableVerdictSchema = z.object({
    applicable: z.literal(false),
});
const ApplicableVerdictSchema = z.object({
    applicable: z.literal(true),
    pass: z.boolean(),
    score: z.number().min(0).max(1),
    reason: z.string(),
});
export const ConsumerVerificationVerdictSchema = z.discriminatedUnion("applicable", [NotApplicableVerdictSchema, ApplicableVerdictSchema]);
/**
 * Shape contract for the `consumerVerification` artifact payload written
 * per (run, mode, task, model). No artifact read-back path consumes it yet.
 */
export const ConsumerVerificationReportSchema = z.object({
    verifier: z.string().min(1),
    pass: z.boolean(),
    score: z.number().min(0).max(1),
    reason: z.string(),
    durationMs: z.number().nonnegative(),
});
/**
 * The `consumerVerification` block of `EvalConfigSchema`. `module` must be
 * an absolute path or `file://` URL so resolution semantics stay
 * unambiguous regardless of the caller's cwd.
 */
export const ConsumerVerificationConfigSchema = z.object({
    module: z
        .string()
        .refine((m) => m.startsWith("/") || m.startsWith("file://"), {
        message: "consumerVerification.module must be an absolute path or file:// URL — relative paths are not yet supported",
    }),
    codeCorrectnessWeight: z.number().min(0).max(1).optional(),
    timeoutMs: z.number().int().positive().optional(),
});
