/** * Module Configurations - Registro central de todos los módulos */ import type { BaseConfig, ModuleCategory } from '../registry.ts'; import type { BaseType, ViewType } from '@/types/index.ts'; // Configuración de todos los módulos export const MODULE_CONFIGS: Record = { // ═══════════════════════════════════════════════════════════════ // TAXONOMÍA (public schema) // ═══════════════════════════════════════════════════════════════ hst: { id: 'hst', name: 'Hashtags Semánticos', shortName: 'HST', category: 'taxonomy', renderType: 'standard', views: { grid: true, tree: true, graph: true }, defaultView: 'grid', api: { schema: null, table: 'hst', hasLibraries: true, hasGroups: true, hasGraph: true, hasTree: true }, enabled: true }, flg: { id: 'flg', name: 'Flags', shortName: 'FLG', category: 'taxonomy', renderType: 'standard', views: { grid: true, tree: true, graph: false }, defaultView: 'grid', api: { schema: null, table: 'flg', hasLibraries: true, hasGroups: true, hasGraph: false, hasTree: false }, enabled: true }, itm: { id: 'itm', name: 'Items', shortName: 'ITM', category: 'taxonomy', renderType: 'standard', views: { grid: true, tree: true, graph: false }, defaultView: 'grid', api: { schema: null, table: 'itm', hasLibraries: true, hasGroups: true, hasGraph: false, hasTree: false }, enabled: true }, loc: { id: 'loc', name: 'Locations', shortName: 'LOC', category: 'taxonomy', renderType: 'standard', views: { grid: true, tree: true, graph: false }, defaultView: 'grid', api: { schema: null, table: 'loc', hasLibraries: true, hasGroups: true, hasGraph: false, hasTree: false }, enabled: true }, ply: { id: 'ply', name: 'Players', shortName: 'PLY', category: 'taxonomy', renderType: 'standard', views: { grid: true, tree: true, graph: false }, defaultView: 'grid', api: { schema: null, table: 'ply', hasLibraries: true, hasGroups: true, hasGraph: false, hasTree: false }, enabled: true }, // ═══════════════════════════════════════════════════════════════ // MAESTROS (secretaria_clara schema) // ═══════════════════════════════════════════════════════════════ mst: { id: 'mst', name: 'Masters', shortName: 'MST', category: 'masters', renderType: 'standard', views: { grid: true, tree: false, graph: false }, defaultView: 'grid', api: { schema: 'secretaria_clara', table: 'mst', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, enabled: true }, bck: { id: 'bck', name: 'Backups', shortName: 'BCK', category: 'masters', renderType: 'standard', views: { grid: true, tree: false, graph: false }, defaultView: 'grid', api: { schema: 'secretaria_clara', table: 'bck', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, enabled: true }, // ═══════════════════════════════════════════════════════════════ // REGISTRO (secretaria_clara / production_alfred) // ═══════════════════════════════════════════════════════════════ atc: { id: 'atc', name: 'Attachments', shortName: 'ATC', category: 'registry', renderType: 'standard', views: { grid: true, tree: false, graph: false }, defaultView: 'grid', api: { schema: 'secretaria_clara', table: 'atc', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, enabled: true }, mth: { id: 'mth', name: 'Methods', shortName: 'MTH', category: 'registry', renderType: 'standard', views: { grid: true, tree: false, graph: false }, defaultView: 'grid', api: { schema: 'production_alfred', table: 'mth', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, enabled: true }, // ═══════════════════════════════════════════════════════════════ // COMUNICACIÓN (mail_manager / context_manager) // Interfaz de chat con IA // ═══════════════════════════════════════════════════════════════ mail: { id: 'mail', name: 'Mail Assistant', shortName: 'MAIL', category: 'communication', renderType: 'chat', views: { custom: 'ChatView' }, defaultView: 'custom', api: { schema: 'mail_manager', table: 'clara_registros', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, customModule: () => import('../custom/MailModule.ts'), enabled: false // Próximamente }, chat: { id: 'chat', name: 'Context Manager', shortName: 'CHAT', category: 'communication', renderType: 'chat', views: { custom: 'ChatView' }, defaultView: 'custom', api: { schema: 'context_manager', table: 'messages', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, customModule: () => import('../custom/ContextModule.ts'), enabled: false // Próximamente }, // ═══════════════════════════════════════════════════════════════ // SERVICIOS (interfaces custom) // ═══════════════════════════════════════════════════════════════ key: { id: 'key', name: 'Keys', shortName: 'KEY', category: 'services', renderType: 'custom', views: { custom: 'KeyView' }, defaultView: 'custom', api: { schema: null, table: 'key', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, customModule: () => import('../custom/KeyModule.ts'), enabled: false // Próximamente }, mindlink: { id: 'mindlink', name: 'MindLink', shortName: 'MIND', category: 'services', renderType: 'custom', views: { custom: 'MindlinkView' }, defaultView: 'custom', api: { schema: null, table: 'mindlink', hasLibraries: false, hasGroups: false, hasGraph: false, hasTree: false }, customModule: () => import('../custom/MindlinkModule.ts'), enabled: false // Próximamente } }; // ═══════════════════════════════════════════════════════════════ // Helpers // ═══════════════════════════════════════════════════════════════ /** * Obtener configuración de un módulo */ export const getModuleConfig = (base: BaseType): BaseConfig => { const config = MODULE_CONFIGS[base]; if (!config) { throw new Error(`Module config not found for base: ${base}`); } return config; }; /** * Agrupar módulos por categoría para UI */ export const getModulesByCategory = (): Record => { const result: Record = { taxonomy: [], masters: [], registry: [], communication: [], services: [] }; Object.values(MODULE_CONFIGS).forEach(config => { result[config.category].push(config); }); return result; }; /** * Obtener solo módulos habilitados */ export const getEnabledModules = (): BaseConfig[] => { return Object.values(MODULE_CONFIGS).filter(c => c.enabled !== false); }; /** * Verificar si un módulo está habilitado */ export const isModuleEnabled = (base: BaseType): boolean => { return MODULE_CONFIGS[base]?.enabled !== false; }; /** * Obtener schema y tabla para API (compatibilidad con código existente) */ export const getSchemaAndTable = (base: BaseType): { schema: string | null; table: string } => { const config = MODULE_CONFIGS[base]; if (!config) { return { schema: null, table: base }; } return { schema: config.api.schema, table: config.api.table }; }; /** * Verificar si una base soporta bibliotecas */ export const supportsLibraries = (base: BaseType): boolean => { return MODULE_CONFIGS[base]?.api.hasLibraries ?? false; }; /** * Verificar si una base soporta grupos */ export const supportsGroups = (base: BaseType): boolean => { return MODULE_CONFIGS[base]?.api.hasGroups ?? false; }; /** * Verificar si una vista está soportada por una base */ export const supportsView = (base: BaseType, view: ViewType): boolean => { const config = MODULE_CONFIGS[base]; if (!config) return false; return !!config.views[view]; }; /** * Obtener vista por defecto de una base */ export const getDefaultView = (base: BaseType): ViewType | 'custom' => { return MODULE_CONFIGS[base]?.defaultView ?? 'grid'; };