import { api } from './api'; export type ConsistencySeverity = 'ok' | 'warn' | 'error'; export type ConsistencyStatus = 'pass' | 'fail'; export interface ConsistencyCheckResult { id: string; label: string; severity: ConsistencySeverity; count: number; message: string; } export interface ConsistencyResult { generatedAt: string; status: ConsistencyStatus; counts: Record; checks: { partitionKeys: ConsistencyCheckResult[]; orphanReferences: ConsistencyCheckResult[]; auditCoverage: ConsistencyCheckResult[]; }; summary: { errors: number; warnings: number; human: string; }; } export function getConsistencyReport() { return api.get('/consistency'); } export function summarizeConsistencyResult(result: ConsistencyResult) { const checks = [ ...result.checks.partitionKeys, ...result.checks.orphanReferences, ...result.checks.auditCoverage, ]; return { ok: checks.filter((item) => item.severity === 'ok').length, warn: checks.filter((item) => item.severity === 'warn').length, error: checks.filter((item) => item.severity === 'error').length, total: checks.length, }; }