import { NormalizedEntities } from '../normalization/normalizer'; import { IntegrityChecker, IntegrityReport, IntegrityViolation, RepairOptions, RepairResult } from '../integrity/integrity-checker'; import { ConsistencyMonitor, DriftResult, MonitorStatus, StateSnapshot } from '../integrity/consistency-monitor'; /** * Integrity state */ export interface IntegrityState { /** Overall validity */ isValid: boolean; /** Is checking */ isChecking: boolean; /** Is repairing */ isRepairing: boolean; /** Last check report */ lastReport: IntegrityReport | null; /** Current violations */ violations: IntegrityViolation[]; /** Violations by severity */ violationsByType: { errors: IntegrityViolation[]; warnings: IntegrityViolation[]; info: IntegrityViolation[]; }; /** Last check timestamp */ lastCheckAt: number | null; /** Check duration */ lastCheckDuration: number | null; } /** * Integrity hook options */ export interface UseDataIntegrityOptions { /** Auto check on mount */ autoCheck?: boolean; /** Auto check on entity changes */ checkOnChange?: boolean; /** Debounce delay for change checks */ debounceMs?: number; /** Auto repair on violations */ autoRepair?: boolean; /** Repair only errors (not warnings) */ repairErrorsOnly?: boolean; /** Callback on violations detected */ onViolations?: (violations: IntegrityViolation[]) => void; /** Callback on integrity valid */ onValid?: () => void; /** Callback on repair complete */ onRepair?: (result: RepairResult) => void; } /** * Integrity hook return type */ export interface UseDataIntegrityReturn { /** Current state */ state: IntegrityState; /** Is valid */ isValid: boolean; /** Is checking */ isChecking: boolean; /** Is repairing */ isRepairing: boolean; /** All violations */ violations: IntegrityViolation[]; /** Error violations only */ errors: IntegrityViolation[]; /** Warning violations only */ warnings: IntegrityViolation[]; /** Last report */ lastReport: IntegrityReport | null; /** Check integrity now */ checkIntegrity: () => IntegrityReport; /** Check specific entity */ checkEntity: (entityType: string, entityId: string) => IntegrityViolation[]; /** Repair violations */ repair: (options?: RepairOptions) => RepairResult; /** Clear state */ clear: () => void; /** Get violations for entity */ getEntityViolations: (entityType: string, entityId: string) => IntegrityViolation[]; /** Check if entity has violations */ hasEntityViolations: (entityType: string, entityId: string) => boolean; } /** * Hook for data integrity checking * * @param checker - Integrity checker instance * @param entities - Normalized entities to check * @param options - Hook options * @returns Integrity state and methods */ export declare function useDataIntegrity(checker: IntegrityChecker, entities: NormalizedEntities, options?: UseDataIntegrityOptions): UseDataIntegrityReturn; /** * Hook for monitoring integrity with consistency monitor * * @param monitor - Consistency monitor instance * @param entities - Normalized entities * @returns Monitor state and actions */ export declare function useIntegrityMonitor(monitor: ConsistencyMonitor, entities: NormalizedEntities): { status: MonitorStatus; isValid: boolean; violations: IntegrityViolation[]; lastReport: IntegrityReport | null; check: () => Promise; repair: (options?: RepairOptions) => Promise; createSnapshot: (label?: string) => StateSnapshot; snapshots: StateSnapshot[]; }; /** * Hook for drift detection * * @param monitor - Consistency monitor instance * @param entities - Normalized entities * @returns Drift detection state */ export declare function useIntegrityDrift(monitor: ConsistencyMonitor, entities: NormalizedEntities): { hasDrift: boolean; drift: DriftResult | null; detectDrift: () => DriftResult | null; compareWithSnapshot: (snapshotId: string) => DriftResult | null; createSnapshot: (label?: string) => StateSnapshot; snapshots: StateSnapshot[]; }; /** * Hook for entity-level integrity checking * * @param checker - Integrity checker instance * @param entities - Normalized entities * @param entityType - Entity type to check * @param entityId - Entity ID to check * @returns Entity integrity state */ export declare function useEntityIntegrity(checker: IntegrityChecker, entities: NormalizedEntities, entityType: string, entityId: string): { isValid: boolean; violations: IntegrityViolation[]; check: () => IntegrityViolation[]; };