/**
 * TaskEvidence discriminated union — typed evidence references for verification records.
 *
 * Replaces free-text evidence fields in verification records with structured,
 * kind-specific evidence artifacts. Each variant carries a SHA-256 attachment
 * reference, a timestamp, and optional description.
 *
 * Five evidence kinds are supported:
 * - `file`           — a file artifact (source file, output artifact, config)
 * - `log`            — a log stream captured from a process
 * - `screenshot`     — a visual capture (PNG/JPEG/WEBP)
 * - `test-output`    — structured test-runner output
 * - `command-output` — raw stdout/stderr from a shell command
 *
 * @epic T760
 * @task T801
 * @see {@link AcceptanceGateResult} — `evidence` field
 */
import { z } from 'zod';
// ─── Zod schemas ─────────────────────────────────────────────────────────────
/** Zod schema for {@link FileEvidence}. */
export const fileEvidenceSchema = z.object({
    kind: z.literal('file'),
    sha256: z.string().length(64),
    timestamp: z.string().datetime(),
    path: z.string().min(1),
    mime: z.string().optional(),
    description: z.string().optional(),
});
/** Zod schema for {@link LogEvidence}. */
export const logEvidenceSchema = z.object({
    kind: z.literal('log'),
    sha256: z.string().length(64),
    timestamp: z.string().datetime(),
    source: z.string().min(1),
    description: z.string().optional(),
});
/** Zod schema for {@link ScreenshotEvidence}. */
export const screenshotEvidenceSchema = z.object({
    kind: z.literal('screenshot'),
    sha256: z.string().length(64),
    timestamp: z.string().datetime(),
    mime: z.enum(['image/png', 'image/jpeg', 'image/webp']).optional(),
    description: z.string().optional(),
});
/** Zod schema for {@link TestOutputEvidence}. */
export const testOutputEvidenceSchema = z.object({
    kind: z.literal('test-output'),
    sha256: z.string().length(64),
    timestamp: z.string().datetime(),
    passed: z.number().int().nonnegative(),
    failed: z.number().int().nonnegative(),
    skipped: z.number().int().nonnegative(),
    exitCode: z.number().int(),
    description: z.string().optional(),
});
/** Zod schema for {@link CommandOutputEvidence}. */
export const commandOutputEvidenceSchema = z.object({
    kind: z.literal('command-output'),
    sha256: z.string().length(64),
    timestamp: z.string().datetime(),
    cmd: z.string().min(1),
    exitCode: z.number().int(),
    description: z.string().optional(),
});
/**
 * Zod discriminated-union schema for {@link TaskEvidence}.
 *
 * Uses `z.discriminatedUnion('kind', [...])` for O(1) variant lookup.
 *
 * @example
 * ```ts
 * const ev = taskEvidenceSchema.parse({
 *   kind: 'command-output',
 *   sha256: 'a'.repeat(64),
 *   timestamp: '2026-04-15T10:00:00.000Z',
 *   cmd: 'pnpm run build',
 *   exitCode: 0,
 * });
 * ```
 */
export const taskEvidenceSchema = z.discriminatedUnion('kind', [
    fileEvidenceSchema,
    logEvidenceSchema,
    screenshotEvidenceSchema,
    testOutputEvidenceSchema,
    commandOutputEvidenceSchema,
]);
//# sourceMappingURL=task-evidence.js.map