export type ServiceCategory =
  | 'CORE'
  | 'BUSINESS'
  | 'TELEMETRY'
  | 'SECURITY'
  | 'NETWORK'
  | 'AI'
  | 'LOGISTICS'
  | 'FINANCE'
  | 'MARKETING';

export const SERVICE_CATEGORIES: ServiceCategory[] = [
  'CORE',
  'BUSINESS',
  'TELEMETRY',
  'SECURITY',
  'NETWORK',
  'AI',
  'LOGISTICS',
  'FINANCE',
  'MARKETING',
];

export interface ServiceConfig {
  name: string;
  category: ServiceCategory;
  description: string;
  enabled: boolean;
  memoryImpact: 'low' | 'medium' | 'high';
  dependencies?: string[];
  aliases?: string[];
  isAgi?: boolean;
}

export const SERVICE_CONFIGS: ServiceConfig[] = [
  {
    name: 'AuthService',
    category: 'CORE',
    description: '用户认证服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'TurboGateway',
    category: 'CORE',
    description: 'API网关与缓存',
    enabled: true,
    memoryImpact: 'medium',
  },
  {
    name: 'FeatureGovernance',
    category: 'CORE',
    description: '功能治理服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'QuotaGovernance',
    category: 'CORE',
    description: '配额治理服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'TenantService',
    category: 'CORE',
    description: '租户管理服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'DomainEventBus',
    category: 'CORE',
    description: '事件总线',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'BillingService',
    category: 'CORE',
    description: '账单服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'ProductService',
    category: 'BUSINESS',
    description: '商品管理服务',
    enabled: true,
    memoryImpact: 'medium',
  },
  {
    name: 'SyncService',
    category: 'BUSINESS',
    description: '数据同步服务',
    enabled: true,
    memoryImpact: 'medium',
  },
  {
    name: 'WarehouseService',
    category: 'BUSINESS',
    description: '仓库管理服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'WebhookService',
    category: 'BUSINESS',
    description: 'Webhook服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'AuditService',
    category: 'CORE',
    description: '审计服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'RBACService',
    category: 'CORE',
    description: '权限管理服务',
    enabled: true,
    memoryImpact: 'low',
  },
  {
    name: 'MemoryWatchdog',
    category: 'TELEMETRY',
    description: '内存监控服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'WorkerProfiler',
    category: 'TELEMETRY',
    description: 'Worker性能分析',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DeadlockAdvisor',
    category: 'TELEMETRY',
    description: '死锁检测顾问',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DLQMonitor',
    category: 'TELEMETRY',
    description: '死信队列监控',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'TransactionScopeService',
    category: 'TELEMETRY',
    description: '事务范围审计',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'PredictiveHealth',
    category: 'TELEMETRY',
    description: '预测性健康检查',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'AutoDiagnostics',
    category: 'TELEMETRY',
    description: '自动诊断服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'CostAttribution',
    category: 'TELEMETRY',
    description: '成本归因分析',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'TracingTopo',
    category: 'TELEMETRY',
    description: '链路拓扑追踪',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'SemanticLog',
    category: 'TELEMETRY',
    description: '语义日志服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SecurityScan',
    category: 'SECURITY',
    description: '安全扫描服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'CacheConsistency',
    category: 'SECURITY',
    description: '缓存一致性检查',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PermissionAudit',
    category: 'SECURITY',
    description: '权限审计服务',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'ContainerSecurity',
    category: 'SECURITY',
    description: '容器安全服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SSLWatch',
    category: 'SECURITY',
    description: 'SSL证书监控',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'DIDHandshake',
    category: 'SECURITY',
    description: 'DID身份握手',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'VaultService',
    category: 'SECURITY',
    description: '密钥保管服务',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'FederatedNode',
    category: 'NETWORK',
    description: '联邦节点服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'P2PConnection',
    category: 'NETWORK',
    description: 'P2P连接服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'PrivateInventorySync',
    category: 'NETWORK',
    description: '私有库存同步',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'ChatBot',
    category: 'AI',
    description: 'AI聊天机器人',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['ChatBotService'],
  },
  {
    name: 'ImageRecognition',
    category: 'AI',
    description: '图像识别服务',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['ImageRecognitionService'],
  },
  {
    name: 'NaturalLanguageProcessing',
    category: 'AI',
    description: '自然语言处理',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['NaturalLanguageProcessingService'],
  },
  {
    name: 'Recommendation',
    category: 'AI',
    description: '推荐系统服务',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['RecommendationService'],
  },
  {
    name: 'DecisionExplainability',
    category: 'AI',
    description: '决策可解释引擎',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'AgentSwarm',
    category: 'AI',
    description: 'Agent集群服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'AutonomousSandbox',
    category: 'AI',
    description: '自主沙箱服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'RedTeaming',
    category: 'AI',
    description: '红队测试服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'SelfHealing',
    category: 'AI',
    description: '自愈服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'RouteOptimizer',
    category: 'LOGISTICS',
    description: '路线优化服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['RouteOptimizerService'],
  },
  {
    name: 'LastMileAI',
    category: 'LOGISTICS',
    description: '最后一公里AI',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['LastMileAIService'],
  },
  {
    name: 'FreightAudit',
    category: 'LOGISTICS',
    description: '运费审计服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['FreightAuditService'],
  },
  {
    name: 'CongestionFailover',
    category: 'LOGISTICS',
    description: '拥堵故障转移',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['CongestionFailoverService'],
  },
  {
    name: 'LogisticTelemetry',
    category: 'LOGISTICS',
    description: '物流遥测服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['LogisticTelemetryService'],
  },
  {
    name: 'CashflowForecast',
    category: 'FINANCE',
    description: '现金流预测',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['CashflowForecastService'],
  },
  {
    name: 'CashflowPredictor',
    category: 'FINANCE',
    description: '现金流预测器',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'DynamicPricing',
    category: 'FINANCE',
    description: '动态定价服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['DynamicPricingService'],
  },
  {
    name: 'MarginProtector',
    category: 'FINANCE',
    description: '利润保护服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['MarginProtectorService'],
  },
  {
    name: 'CurrencyRisk',
    category: 'FINANCE',
    description: '汇率风险服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['CurrencyRiskService'],
  },
  {
    name: 'TaxCompliance',
    category: 'FINANCE',
    description: '税务合规服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['TaxComplianceService'],
  },
  {
    name: 'FinanceReconciliation',
    category: 'FINANCE',
    description: '财务对账服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['FinanceReconciliationService'],
  },
  {
    name: 'OrderProfit',
    category: 'FINANCE',
    description: '订单利润分析',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['OrderProfitService'],
  },
  {
    name: 'PricingAudit',
    category: 'FINANCE',
    description: '定价审计服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['PricingAuditService'],
  },
  {
    name: 'KOL',
    category: 'MARKETING',
    description: 'KOL营销服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['KOLService'],
  },
  {
    name: 'SocialPulse',
    category: 'MARKETING',
    description: '社交舆情服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['SocialPulseService'],
  },
  {
    name: 'MarketingCalendar',
    category: 'MARKETING',
    description: '营销日历服务',
    enabled: false,
    memoryImpact: 'low',
    aliases: ['MarketingCalendarService'],
  },
  {
    name: 'AdOptimizer',
    category: 'MARKETING',
    description: '广告优化服务',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['AdOptimizerService'],
  },
  {
    name: 'TrueROAS',
    category: 'MARKETING',
    description: '真实ROAS计算',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['TrueROASService'],
  },
  {
    name: 'ExperimentHub',
    category: 'BUSINESS',
    description: 'A/B测试实验平台',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'UnifiedTaskHub',
    category: 'BUSINESS',
    description: '统一任务中心',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SKUMapper',
    category: 'BUSINESS',
    description: 'SKU映射服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SovereignReputationV2',
    category: 'NETWORK',
    description: '主权信誉服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'AutoCircuitBreaker',
    category: 'SECURITY',
    description: '自动熔断器',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PriorityAsyncEngine',
    category: 'CORE',
    description: '优先级异步引擎',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PluginManager',
    category: 'CORE',
    description: '插件管理器',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'EventBusOptimization',
    category: 'CORE',
    description: '事件总线优化',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Warmup',
    category: 'CORE',
    description: '预热服务',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'DocsSync',
    category: 'CORE',
    description: '文档同步服务',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'S3Quota',
    category: 'CORE',
    description: 'S3配额管理',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'ContainerQuota',
    category: 'CORE',
    description: '容器配额管理',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'DBSharding',
    category: 'CORE',
    description: '数据库分片服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SnowflakeID',
    category: 'CORE',
    description: '雪花ID生成器',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'FeatureToggle',
    category: 'CORE',
    description: '功能开关服务',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'AutoScaling',
    category: 'CORE',
    description: '自动扩缩容服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'CreativeService',
    category: 'AI',
    description: '创意生成服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'VisualSourcing',
    category: 'AI',
    description: '视觉寻源服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'SLAScoring',
    category: 'AI',
    description: 'SLA评分服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'TrustEvolution',
    category: 'AI',
    description: '信任演进服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DisputeClassifier',
    category: 'AI',
    description: '纠纷分类服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'GreenSupply',
    category: 'AI',
    description: '绿色供应链服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'HolidayRisk',
    category: 'AI',
    description: '假日风险评估',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PackingOptimizer',
    category: 'AI',
    description: '包装优化服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'StuckTracking',
    category: 'AI',
    description: '滞留跟踪服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'InvoiceLateRisk',
    category: 'AI',
    description: '发票延迟风险',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'ContentGap',
    category: 'AI',
    description: '内容缺口分析',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'GlobalCSMonitor',
    category: 'AI',
    description: '全球客服监控',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'ProcurementAudit',
    category: 'AI',
    description: '采购审计服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SensibleStock',
    category: 'AI',
    description: '合理库存服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PaymentRisk',
    category: 'AI',
    description: '支付风险服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DynamicShipping',
    category: 'AI',
    description: '动态物流服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'LeadTimeDrift',
    category: 'AI',
    description: '交期漂移检测',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'InventoryAging',
    category: 'AI',
    description: '库存老化分析',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SupplierRiskRadar',
    category: 'AI',
    description: '供应商风险雷达',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PlatformFeeWatcher',
    category: 'AI',
    description: '平台费用监控',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'StyleWar',
    category: 'AI',
    description: '款式竞争分析',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SeaFreightAdvisor',
    category: 'AI',
    description: '海运咨询顾问',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'AutoRCA',
    category: 'AI',
    description: '自动根因分析',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SandboxROIAdvisor',
    category: 'AI',
    description: '沙箱ROI顾问',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'V2MigrationAdvisor',
    category: 'AI',
    description: 'V2迁移顾问',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'LastMileOptimizer',
    category: 'LOGISTICS',
    description: '最后一公里优化',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['LastMileOptimizerService'],
  },
  {
    name: 'SupplierScoring',
    category: 'LOGISTICS',
    description: '供应商评分服务',
    enabled: false,
    memoryImpact: 'medium',
    aliases: ['SupplierScoringService'],
  },
  {
    name: 'GlobalFulfillment',
    category: 'LOGISTICS',
    description: '全球履约服务',
    enabled: false,
    memoryImpact: 'high',
    aliases: ['GlobalFulfillmentService'],
  },
  {
    name: 'TradeService',
    category: 'LOGISTICS',
    description: '贸易服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PaymentTerms',
    category: 'FINANCE',
    description: '付款条款服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'RemitPath',
    category: 'FINANCE',
    description: '汇款路径服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'StockAudit',
    category: 'FINANCE',
    description: '库存审计服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'TenantHealth',
    category: 'FINANCE',
    description: '租户健康服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Rebate',
    category: 'FINANCE',
    description: '返利服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'FinancialAudit',
    category: 'FINANCE',
    description: '财务审计服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Expense',
    category: 'FINANCE',
    description: '费用管理服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'MaterialRisk',
    category: 'FINANCE',
    description: '物料风险服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'RefundAudit',
    category: 'FINANCE',
    description: '退款审计服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'CACThreshold',
    category: 'FINANCE',
    description: 'CAC阈值服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Commission',
    category: 'FINANCE',
    description: '佣金服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'TurnoverWatchdog',
    category: 'FINANCE',
    description: '周转看门狗',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Warranty',
    category: 'FINANCE',
    description: '保修服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'TaxFilingAdvisor',
    category: 'FINANCE',
    description: '税务申报顾问',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'CreditMonitor',
    category: 'FINANCE',
    description: '信用监控服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'LegalTax',
    category: 'FINANCE',
    description: '法律税务服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PayoutOptimizer',
    category: 'FINANCE',
    description: '支付优化服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'FinancialPlanner',
    category: 'FINANCE',
    description: '财务规划服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'VendorCredit',
    category: 'FINANCE',
    description: '供应商信用服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'BillingEngine',
    category: 'FINANCE',
    description: '计费引擎服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'MultiAssetSettlement',
    category: 'FINANCE',
    description: '多资产结算服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'SovereignCreditPool',
    category: 'FINANCE',
    description: '主权信用池服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'Invoicing',
    category: 'FINANCE',
    description: '发票服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'PoolSourcing',
    category: 'FINANCE',
    description: '池化采购服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SovereignWealthFund',
    category: 'FINANCE',
    description: '主权基金服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'CommodityHedging',
    category: 'FINANCE',
    description: '商品对冲服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'TaxPlanning',
    category: 'FINANCE',
    description: '税务规划服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'BusinessModelEvolution',
    category: 'AI',
    description: '商业模式演进',
    enabled: false,
    memoryImpact: 'high',
    isAgi: true,
  },
  {
    name: 'Review',
    category: 'AI',
    description: '评论服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DisputeResolver',
    category: 'AI',
    description: '纠纷解决服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Supplier',
    category: 'AI',
    description: '供应商服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'MediaAsset',
    category: 'AI',
    description: '媒体资产服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'Report',
    category: 'AI',
    description: '报表服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'FeatureActivation',
    category: 'AI',
    description: '功能激活服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'MerchantSettlement',
    category: 'FINANCE',
    description: '商户结算服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'MerchantProductOrder',
    category: 'FINANCE',
    description: '商户商品订单服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'QuotaCircuitBreaker',
    category: 'TELEMETRY',
    description: '配额熔断服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DataCompliance',
    category: 'TELEMETRY',
    description: '数据合规服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'RuntimeSystem',
    category: 'CORE',
    description: '运行时系统',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'EventBus',
    category: 'CORE',
    description: '事件总线',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'LogMasking',
    category: 'SECURITY',
    description: '日志脱敏',
    enabled: false,
    memoryImpact: 'low',
  },
  {
    name: 'SecureVault',
    category: 'SECURITY',
    description: '安全保险库',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'CustomerService',
    category: 'AI',
    description: '客户服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SupportService',
    category: 'AI',
    description: '支持服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'DisputeAdvisor',
    category: 'AI',
    description: '纠纷顾问',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'BehavioralRisk',
    category: 'AI',
    description: '行为风险服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'ActionAudit',
    category: 'CORE',
    description: '行为审计',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'ReconciliationService',
    category: 'FINANCE',
    description: '对账服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'InventoryForecast',
    category: 'LOGISTICS',
    description: '库存预测服务',
    enabled: false,
    memoryImpact: 'medium',
  },
  {
    name: 'SovereignCrisis',
    category: 'LOGISTICS',
    description: '主权危机服务',
    enabled: false,
    memoryImpact: 'high',
  },
  {
    name: 'SovereignCarbon',
    category: 'AI',
    description: '主权碳服务',
    enabled: false,
    memoryImpact: 'medium',
  },
];

const SERVICE_NAME_TO_CANONICAL = new Map<string, string>();
const CANONICAL_TO_SERVICE_CONFIG = new Map<string, ServiceConfig>();

for (const config of SERVICE_CONFIGS) {
  CANONICAL_TO_SERVICE_CONFIG.set(config.name, config);
  SERVICE_NAME_TO_CANONICAL.set(config.name, config.name);
  if (config.aliases) {
    for (const alias of config.aliases) {
      SERVICE_NAME_TO_CANONICAL.set(alias, config.name);
    }
  }
}

export function resolveServiceName(name: string): string {
  return SERVICE_NAME_TO_CANONICAL.get(name) || name;
}

export function getServiceConfig(name: string): ServiceConfig | undefined {
  const canonical = resolveServiceName(name);
  return CANONICAL_TO_SERVICE_CONFIG.get(canonical);
}

export function isServiceEnabled(name: string): boolean {
  const config = getServiceConfig(name);
  return config?.enabled ?? false;
}

export function getCanonicalNames(): string[] {
  return Array.from(CANONICAL_TO_SERVICE_CONFIG.keys());
}

export function getAllServiceAliases(): Map<string, string> {
  return SERVICE_NAME_TO_CANONICAL;
}
