/**
 * Main Path Integration Contract — 工厂函数 + 反馈构建
 */
import { statusLabel, entryTypeLabel } from "./queries.js";
/**
 * 创建主链路接入契约。
 */
export function createMainPathIntegrationContract(params) {
    return {
        module_path: params.module_path,
        capability_id: params.capability_id,
        contract_id: params.contract_id,
        issue_id: params.issue_id,
        status: params.status ?? "implemented_not_integrated",
        production_imports: params.production_imports ?? [],
        entry_traces: params.entry_traces ?? [],
        observability_refs: params.observability_refs ?? [],
        integration_tests: params.integration_tests ?? [],
        allowed_isolation_reason: params.allowed_isolation_reason,
        owner: params.owner,
    };
}
/**
 * 创建入口链路追踪记录。
 */
export function createEntryPointTrace(params) {
    return {
        entry_type: params.entry_type,
        entry_id: params.entry_id,
        call_chain: params.call_chain,
        trigger_example: params.trigger_example,
        evidence_ref: params.evidence_ref,
    };
}
/**
 * 构建集成反馈信息。
 */
export function buildIntegrationFeedback(contract) {
    const lines = [];
    lines.push(`模块: ${contract.module_path}`);
    lines.push(`状态: ${statusLabel(contract.status)}`);
    lines.push(`负责人: ${contract.owner}`);
    if (contract.entry_traces.length > 0) {
        lines.push(`入口链路:`);
        for (const t of contract.entry_traces) {
            lines.push(`  - ${entryTypeLabel(t.entry_type)}: ${t.entry_id}`);
            lines.push(`    调用链: ${t.call_chain.join(" -> ")}`);
            lines.push(`    触发示例: ${t.trigger_example}`);
        }
    }
    else {
        lines.push(`入口链路: 无 (模块未接入主链路)`);
    }
    lines.push(`生产调用: ${contract.production_imports.length > 0 ? contract.production_imports.join(", ") : "无"}`);
    lines.push(`可观测: ${contract.observability_refs.length > 0 ? contract.observability_refs.join(", ") : "无"}`);
    lines.push(`集成测试: ${contract.integration_tests.length > 0 ? contract.integration_tests.join(", ") : "无"}`);
    if (contract.allowed_isolation_reason) {
        lines.push(`豁免原因: ${contract.allowed_isolation_reason}`);
    }
    return lines.join("\n");
}
//# sourceMappingURL=factories.js.map