// engine/dor-dod/items-loader.ts — Config-driven DoR/DoD item definitions (SPEC-212)
import { z } from 'zod';
import { ConfigLoader } from '../config-loader.js';
/** Schema for a single DoR or DoD item definition from config. */
const DorDodItemDefSchema = z.object({
    id: z.string().describe('Stable identifier for this item (e.g. "dor-1", "dod-3")'),
    kind: z.enum(['dor', 'dod']).describe('Whether this item belongs to DoR or DoD checklist'),
    description: z.string().describe('Human-readable description of the readiness/done criterion'),
    category: z
        .string()
        .describe('Grouping label for the item (e.g. "spec", "design", "technical", "tests")'),
    required: z.boolean().describe('If true, this item is blocking — must pass for ready/done'),
    autoCheck: z
        .boolean()
        .describe('If true, the system can evaluate this item automatically from spec metadata'),
    autoCheckField: z
        .string()
        .nullable()
        .describe('Spec field used for auto-check (null when autoCheck is false)'),
    autoCheckCondition: z
        .string()
        .nullable()
        .describe('Condition code for auto-check evaluation (null when autoCheck is false)'),
    scopeFilter: z
        .array(z.string())
        .optional()
        .describe('If present, item only applies when spec.scope is one of these values'),
    typeFilter: z
        .array(z.string())
        .optional()
        .describe('If present, item only applies when spec.type is one of these values'),
});
const DorDodItemDefArraySchema = z.array(DorDodItemDefSchema);
const loader = new ConfigLoader('dor-dod-items', DorDodItemDefArraySchema);
/**
 * Load all DoR item definitions, filtered to items with kind="dor".
 * Optionally merges project-level overrides.
 */
export function loadDorItemDefs(projectHash) {
    return loader.load(projectHash).filter((item) => item.kind === 'dor');
}
/**
 * Load all DoD item definitions, filtered to items with kind="dod".
 * Optionally merges project-level overrides.
 */
export function loadDodItemDefs(projectHash) {
    return loader.load(projectHash).filter((item) => item.kind === 'dod');
}
/**
 * Get the ConfigLoader instance (for testing / inspection).
 */
export function getDorDodLoader() {
    return loader;
}
//# sourceMappingURL=items-loader.js.map