# TRACEABILITY_MATRIX.yml - Platform Marketing Content
# Matriz de trazabilidad entre requerimientos, historias y componentes
# Version: 1.0.0
# Fecha: 2025-12-08

version: "1.0.0"
proyecto: "Platform Marketing Content"
fecha_actualizacion: "2025-12-08"

# =============================================================================
# RESUMEN DE TRAZABILIDAD
# =============================================================================

resumen:
  total_requerimientos: 167
  total_user_stories: 66
  total_epicas: 8
  cobertura_estimada: 100%

# =============================================================================
# MODULO: PMC-001 TENANTS
# =============================================================================

PMC-001-TENANTS:
  epica: EPIC-001-TENANTS
  requerimientos:
    - RF-PMC-001-001: "Crear tenant con datos basicos"
    - RF-PMC-001-002: "Asignar plan a tenant"
    - RF-PMC-001-003: "Configurar limites por plan"
    - RF-PMC-001-004: "Verificar quotas en operaciones"
    - RF-PMC-001-005: "Dashboard de uso por tenant"
    - RF-PMC-001-006: "Alertas de quota"
    - RF-PMC-001-007: "Upgrade/downgrade de plan"
    - RF-PMC-001-008: "Branding personalizado por tenant"
    # ... mas requerimientos

  user_stories:
    - US-001-001: "Como super admin, quiero crear nuevos tenants"
    - US-001-002: "Como owner, quiero ver el uso de mi organizacion"
    - US-001-003: "Como owner, quiero recibir alertas de quota"
    - US-001-004: "Como owner, quiero cambiar mi plan"
    # ... mas user stories

  componentes:
    database:
      - auth.tenants
      - auth.plans
      - auth.tenant_usage
    backend:
      - TenantsModule
      - TenantService
      - PlanService
      - QuotaService
      - TenantsController
      - PlansController
    frontend:
      - TenantSettingsPage
      - UsageDashboard
      - PlanSelector

  catalogo:
    - "@CATALOG_TENANT"
    - "@CATALOG_PAYMENTS"

# =============================================================================
# MODULO: PMC-002 CRM
# =============================================================================

PMC-002-CRM:
  epica: EPIC-002-CRM
  requerimientos:
    - RF-PMC-002-001: "CRUD de clientes"
    - RF-PMC-002-002: "Asociar contactos a cliente"
    - RF-PMC-002-003: "CRUD de marcas por cliente"
    - RF-PMC-002-004: "Definir style guide de marca"
    - RF-PMC-002-005: "CRUD de productos por marca"
    - RF-PMC-002-006: "Galeria de fotos de producto"
    - RF-PMC-002-007: "Pipeline de oportunidades"
    - RF-PMC-002-008: "Busqueda y filtros avanzados"

  user_stories:
    - US-002-001: "Como ejecutivo, quiero registrar nuevos clientes"
    - US-002-002: "Como ejecutivo, quiero gestionar marcas del cliente"
    - US-002-003: "Como disenador, quiero ver el style guide"
    - US-002-004: "Como ejecutivo, quiero agregar productos"

  componentes:
    database:
      - crm.clients
      - crm.contacts
      - crm.brands
      - crm.products
      - crm.opportunities
    backend:
      - CrmModule
      - ClientService
      - BrandService
      - ProductService
      - ContactService
      - ClientsController
      - BrandsController
      - ProductsController
    frontend:
      - ClientsListPage
      - ClientDetailPage
      - BrandsListPage
      - BrandDetailPage
      - ProductsListPage
      - ProductDetailPage
      - ClientCard
      - BrandForm
      - ProductGallery

# =============================================================================
# MODULO: PMC-003 PROJECTS
# =============================================================================

PMC-003-PROJECTS:
  epica: EPIC-003-PROJECTS
  requerimientos:
    - RF-PMC-003-001: "CRUD de proyectos"
    - RF-PMC-003-002: "Asociar cliente y marca a proyecto"
    - RF-PMC-003-003: "CRUD de campanas dentro de proyecto"
    - RF-PMC-003-004: "Crear brief de campana"
    - RF-PMC-003-005: "Timeline de campana"
    - RF-PMC-003-006: "Flujo de aprobacion"
    - RF-PMC-003-007: "Asociar assets a campana"
    - RF-PMC-003-008: "Exportar campana"

  user_stories:
    - US-003-001: "Como PM, quiero crear proyectos"
    - US-003-002: "Como PM, quiero gestionar campanas"
    - US-003-003: "Como cliente, quiero aprobar contenido"
    - US-003-004: "Como ejecutivo, quiero exportar campana"

  componentes:
    database:
      - projects.projects
      - projects.campaigns
      - projects.briefs
      - projects.campaign_assets
      - projects.approvals
    backend:
      - ProjectsModule
      - ProjectService
      - CampaignService
      - BriefService
      - ApprovalService
      - ProjectsController
      - CampaignsController
    frontend:
      - ProjectsListPage
      - ProjectDetailPage
      - CampaignsListPage
      - CampaignDetailPage
      - BriefEditor
      - ApprovalWorkflow
      - CampaignTimeline

# =============================================================================
# MODULO: PMC-004 GENERATION
# =============================================================================

PMC-004-GENERATION:
  epica: EPIC-004-GENERATION
  requerimientos:
    - RF-PMC-004-001: "Generar imagen con prompt"
    - RF-PMC-004-002: "Seleccionar workflow predefinido"
    - RF-PMC-004-003: "Generar variaciones de imagen"
    - RF-PMC-004-004: "Generacion batch"
    - RF-PMC-004-005: "Cola de prioridad"
    - RF-PMC-004-006: "Progreso en tiempo real"
    - RF-PMC-004-007: "Historial de generaciones"
    - RF-PMC-004-008: "Entrenar modelo LoRA"
    - RF-PMC-004-009: "Usar modelo personalizado"
    - RF-PMC-004-010: "Generar texto con IA"
    - RF-PMC-004-011: "Inpainting/outpainting"
    - RF-PMC-004-012: "Upscaling"

  user_stories:
    - US-004-001: "Como disenador, quiero generar imagenes"
    - US-004-002: "Como disenador, quiero usar workflows"
    - US-004-003: "Como disenador, quiero ver progreso"
    - US-004-004: "Como admin, quiero entrenar modelos"

  componentes:
    database:
      - generation.jobs
      - generation.workflow_templates
      - generation.custom_models
      - generation.text_generations
    backend:
      - GenerationModule
      - GenerationService
      - ComfyUIService
      - WorkflowService
      - ModelService
      - TextGenerationService
      - GenerationController
      - WorkflowsController
      - ModelsController
      - GenerationGateway (WebSocket)
      - ImageGenerationProcessor
      - TextGenerationProcessor
    frontend:
      - GenerationPage
      - GenerationHistoryPage
      - WorkflowsPage
      - ModelsPage
      - GenerationPanel
      - PromptBuilder
      - GenerationProgress
      - ResultsGrid

  catalogo:
    - "@CATALOG_RATELIMIT"
    - "@CATALOG_WS"

# =============================================================================
# MODULO: PMC-005 AUTOMATION
# =============================================================================

PMC-005-AUTOMATION:
  epica: EPIC-005-AUTOMATION
  requerimientos:
    - RF-PMC-005-001: "Crear flujo automatizado"
    - RF-PMC-005-002: "Definir triggers de eventos"
    - RF-PMC-005-003: "Configurar acciones"
    - RF-PMC-005-004: "Integrar con n8n"
    - RF-PMC-005-005: "Webhooks entrantes"
    - RF-PMC-005-006: "Webhooks salientes"
    - RF-PMC-005-007: "Log de ejecuciones"
    - RF-PMC-005-008: "Notificaciones automaticas"

  user_stories:
    - US-005-001: "Como admin, quiero crear automatizaciones"
    - US-005-002: "Como admin, quiero ver log de eventos"
    - US-005-003: "Como sistema, quiero notificar usuarios"

  componentes:
    database:
      - automation.automation_flows
      - automation.automation_runs
      - automation.webhook_endpoints
      - automation.event_logs
    backend:
      - AutomationModule
      - AutomationService
      - WebhookService
      - EventService
      - N8nIntegrationService
      - AutomationController
      - WebhooksController
    frontend:
      - AutomationFlowsPage
      - FlowEditorPage
      - WebhooksPage
      - FlowCard
      - EventLog

  catalogo:
    - "@CATALOG_NOTIFY"

# =============================================================================
# MODULO: PMC-006 ASSETS
# =============================================================================

PMC-006-ASSETS:
  epica: EPIC-006-ASSETS
  requerimientos:
    - RF-PMC-006-001: "Subir assets"
    - RF-PMC-006-002: "Generar thumbnails"
    - RF-PMC-006-003: "Organizar en colecciones"
    - RF-PMC-006-004: "Versionado de assets"
    - RF-PMC-006-005: "Busqueda por metadata"
    - RF-PMC-006-006: "Comentarios en assets"
    - RF-PMC-006-007: "Descargar con tracking"
    - RF-PMC-006-008: "Edicion basica"

  user_stories:
    - US-006-001: "Como disenador, quiero subir assets"
    - US-006-002: "Como PM, quiero organizar en colecciones"
    - US-006-003: "Como cliente, quiero descargar assets"
    - US-006-004: "Como disenador, quiero versionar assets"

  componentes:
    database:
      - assets.assets
      - assets.asset_versions
      - assets.collections
      - assets.collection_assets
      - assets.asset_comments
      - assets.downloads
    backend:
      - AssetsModule
      - AssetService
      - CollectionService
      - StorageService
      - ThumbnailService
      - AssetsController
      - CollectionsController
      - DownloadsController
    frontend:
      - AssetsLibraryPage
      - AssetDetailPage
      - CollectionsPage
      - CollectionDetailPage
      - AssetCard
      - AssetGrid
      - AssetUploader
      - AssetViewer

# =============================================================================
# MODULO: PMC-007 ADMIN
# =============================================================================

PMC-007-ADMIN:
  epica: EPIC-007-ADMIN
  requerimientos:
    - RF-PMC-007-001: "Login con email/password"
    - RF-PMC-007-002: "Registro via invitacion"
    - RF-PMC-007-003: "Roles y permisos"
    - RF-PMC-007-004: "Gestion de usuarios"
    - RF-PMC-007-005: "Perfil de usuario"
    - RF-PMC-007-006: "Sesiones activas"
    - RF-PMC-007-007: "Audit log"
    - RF-PMC-007-008: "Feature flags"

  user_stories:
    - US-007-001: "Como usuario, quiero hacer login"
    - US-007-002: "Como owner, quiero invitar usuarios"
    - US-007-003: "Como admin, quiero asignar roles"
    - US-007-004: "Como usuario, quiero ver mi perfil"

  componentes:
    database:
      - auth.users
      - auth.roles
      - auth.user_sessions
      - auth.invitations
      - auth.audit_logs
    backend:
      - AuthModule
      - AuthService
      - SessionService
      - PasswordService
      - InvitationService
      - AuthController
      - UsersController
      - InvitationsController
      - JwtAuthGuard
      - RolesGuard
    frontend:
      - LoginPage
      - RegisterPage
      - ProfilePage
      - UsersPage
      - RolesPage
      - SettingsPage

  catalogo:
    - "@CATALOG_AUTH"
    - "@CATALOG_SESSION"
    - "@CATALOG_FLAGS"
    - "@CATALOG_NOTIFY"

# =============================================================================
# MODULO: PMC-008 ANALYTICS
# =============================================================================

PMC-008-ANALYTICS:
  epica: EPIC-008-ANALYTICS
  requerimientos:
    - RF-PMC-008-001: "Dashboard de metricas"
    - RF-PMC-008-002: "Metricas de generacion"
    - RF-PMC-008-003: "Metricas de uso"
    - RF-PMC-008-004: "Reportes personalizados"
    - RF-PMC-008-005: "Exportar reportes"
    - RF-PMC-008-006: "Vistas guardadas"
    - RF-PMC-008-007: "Comparativas temporales"

  user_stories:
    - US-008-001: "Como owner, quiero ver dashboard"
    - US-008-002: "Como PM, quiero ver metricas de proyecto"
    - US-008-003: "Como admin, quiero generar reportes"

  componentes:
    database:
      - analytics.metrics
      - analytics.reports
      - analytics.saved_views
    backend:
      - AnalyticsModule
      - AnalyticsService
      - MetricsService
      - ReportService
      - AnalyticsController
      - ReportsController
    frontend:
      - DashboardPage
      - AnalyticsOverviewPage
      - ReportsPage
      - MetricsChart
      - ReportBuilder

# =============================================================================
# MATRIZ DE COBERTURA
# =============================================================================

cobertura:
  por_modulo:
    PMC-001-TENANTS:
      requerimientos: 12
      user_stories: 6
      cobertura: 100%
    PMC-002-CRM:
      requerimientos: 18
      user_stories: 8
      cobertura: 100%
    PMC-003-PROJECTS:
      requerimientos: 22
      user_stories: 10
      cobertura: 100%
    PMC-004-GENERATION:
      requerimientos: 35
      user_stories: 12
      cobertura: 100%
    PMC-005-AUTOMATION:
      requerimientos: 18
      user_stories: 8
      cobertura: 100%
    PMC-006-ASSETS:
      requerimientos: 25
      user_stories: 10
      cobertura: 100%
    PMC-007-ADMIN:
      requerimientos: 22
      user_stories: 8
      cobertura: 100%
    PMC-008-ANALYTICS:
      requerimientos: 15
      user_stories: 4
      cobertura: 100%

# =============================================================================
# REFERENCIAS CRUZADAS
# =============================================================================

referencias:
  documentacion_modulos: docs/02-definicion-modulos/
  requerimientos: docs/03-requerimientos/
  epicas: docs/03-requerimientos/epicas/
  user_stories: docs/03-requerimientos/user-stories/

# =============================================================================
# METADATOS
# =============================================================================

metadata:
  creado_por: Requirements-Analyst
  fecha_creacion: "2025-12-08"
  ultima_actualizacion: "2025-12-08"
