import { isEvidenceRecord, EVIDENCE_INDEX_SCHEMA } from '../evidence/evidence-schema.js';
import { ValidationError } from './validation-error.js';
export function parseEvidenceRecord(value) {
    if (!isEvidenceRecord(value))
        throw new ValidationError('sks.evidence.v1');
    return value;
}
export function parseEvidenceIndex(value) {
    if (!value || typeof value !== 'object')
        throw new ValidationError(EVIDENCE_INDEX_SCHEMA);
    const index = value;
    if (index.schema !== EVIDENCE_INDEX_SCHEMA || !Array.isArray(index.records) || !Array.isArray(index.issues)) {
        throw new ValidationError(EVIDENCE_INDEX_SCHEMA);
    }
    for (const record of index.records)
        parseEvidenceRecord(record);
    return index;
}
//# sourceMappingURL=evidence-validator.js.map