import { z } from 'zod';
import { ReviewFindingSchema } from '../reviews/ReviewFinding.js';
import { ExecutionRunStructuredRunRefSchema } from './executionRunStructuredRunRef.js';
export const ReviewTriageStatusSchema = z.enum([
    'accept',
    'reject',
    'defer',
    'needs_refinement',
]);
export const ReviewTriageOverlaySchema = z.object({
    findings: z.array(z.object({
        id: z.string().min(1),
        status: ReviewTriageStatusSchema,
        comment: z.string().min(1).optional(),
    }).passthrough()),
}).passthrough();
export const ReviewFindingsV1Schema = z.object({
    runRef: ExecutionRunStructuredRunRefSchema,
    summary: z.string().min(1),
    findings: z.array(ReviewFindingSchema),
    triage: ReviewTriageOverlaySchema.optional(),
    limits: z.object({
        findingsTruncated: z.boolean().optional(),
        patchesTruncated: z.boolean().optional(),
    }).passthrough().optional(),
    generatedAtMs: z.number().int().nonnegative(),
}).passthrough();
export function parseReviewFindingsV1(payload) {
    const parsed = ReviewFindingsV1Schema.safeParse(payload);
    if (!parsed.success)
        return null;
    return parsed.data;
}
//# sourceMappingURL=reviewFindingsV1.js.map