import type { AssessorRepository } from '../persistence/assessor-repository'; import type { RegulatoryMappingBatchRun, RegulatoryMappingDecision, RegulatoryMappingRun } from './regulatory-mapping'; /** * The only Core reads the Compliance Engine performs (AGENTS.md, "Core Engine and engines"). The engine * never receives a repository method that writes Core data. */ export type ComplianceReadPort = Pick; export function complianceReadPortFrom(repository: ComplianceReadPort): ComplianceReadPort { return { getUnifiedResultById: (resultProjectionId, projectId) => repository.getUnifiedResultById(resultProjectionId, projectId), queryUnifiedResults: query => repository.queryUnifiedResults(query), getProject: projectId => repository.getProject(projectId), listProjects: () => repository.listProjects(), listAssessments: projectId => repository.listAssessments(projectId), listProjectScanRuns: projectId => repository.listProjectScanRuns(projectId) }; } /** The engine's project data, delivered beside the Core project export. */ export interface ComplianceProjectExport { regulatoryMappingBatchRuns: RegulatoryMappingBatchRun[]; /** Mappings and decisions are global and keyed by scanner rule, not by project. */ regulatoryMappingRuns: RegulatoryMappingRun[]; regulatoryMappingDecisions: RegulatoryMappingDecision[]; } /** The engine's own storage: mapping runs, accept/reject decisions and batches. */ export interface ComplianceStore { getRegulatoryMappingRun(id: string): Promise; claimRegulatoryMappingRun(run: RegulatoryMappingRun, forceRegeneration: boolean): Promise<{ run: RegulatoryMappingRun; claimed: boolean }>; saveRegulatoryMappingRun(run: RegulatoryMappingRun): Promise; listRegulatoryMappingRuns(): Promise; createRegulatoryMappingBatchRun(run: RegulatoryMappingBatchRun): Promise; updateRegulatoryMappingBatchRun(run: RegulatoryMappingBatchRun): Promise; listRegulatoryMappingBatchRuns(projectId: string, scopeKey?: string): Promise; createRegulatoryMappingDecision(decision: RegulatoryMappingDecision, expectedLatestDecisionId?: string): Promise; listRegulatoryMappingDecisions(ruleKey: string): Promise; exportProject(projectId: string): Promise; }