// tools/data-governance.ts — Barrel: Data Governance & Privacy tool handler (SPEC-030)
// Split into subdirectory for SOLID compliance. Subcommands: detect, retention-policy, privacy-notice, audit.
import { knowledgeStore } from '../storage/index.js';
import { ti } from '../i18n/index.js';
import { handleDetect, handleRetentionPolicy } from './data-governance/detect-handler.js';
import { handlePrivacyNotice, handleAudit } from './data-governance/audit-handler.js';
// ---------------------------------------------------------------------------
// Main handler
// ---------------------------------------------------------------------------
export async function handleDataGovernance(args) {
    const { specId, projectId, subcommand, modelName, specContent } = args;
    // Load project knowledge (required for all subcommands)
    const knowledge = await knowledgeStore.getKnowledge(projectId);
    if (!knowledge) {
        return {
            content: [{ type: 'text', text: ti('project.notFound', {}) }],
            isError: true,
        };
    }
    try {
        switch (subcommand) {
            case 'detect':
                return await handleDetect(specId, projectId, specContent, knowledge.projectPath);
            case 'retention-policy':
                return handleRetentionPolicy(modelName, knowledge.projectPath);
            case 'privacy-notice':
                return await handlePrivacyNotice(projectId);
            case 'audit':
                return await handleAudit(projectId);
            /* v8 ignore next 2 */
            default:
                return await handleDetect(specId, projectId, specContent, knowledge.projectPath);
        }
    }
    catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        return {
            content: [{ type: 'text', text: ti('errors.internalError', { message }) }],
            isError: true,
        };
    }
}
//# sourceMappingURL=data-governance.js.map