# =============================================================================
# PROJECT-ENV-CONFIG.yml - TRADING-PLATFORM
# =============================================================================
# Proyecto: TRADING-PLATFORM - Plataforma de Trading Trading Platform
# Actualizado: 2025-12-05
# Referencia: ~/workspace/core/devtools/environment/DEV-ENVIRONMENT-REGISTRY.yml
# Configuración de puertos: /home/isem/workspace/projects/trading-platform/.env.ports
# =============================================================================

project:
  name: "TRADING_PLATFORM"
  slug: "trading-platform"
  description: "Plataforma de Trading con IA y ML para análisis de mercados"
  status: "active-development"
  port_block: 3100
  version: "0.1.0"

# =============================================================================
# PUERTOS DE SERVICIOS
# =============================================================================
ports:
  # Frontend Services
  frontend_web: 3100        # Aplicación React principal
  frontend_admin: 3101      # Panel admin (futuro)
  frontend_preview: 4173    # Vite preview

  # Backend Services (Node.js)
  backend_api: 4000         # Express API REST
  backend_ws: 4001          # WebSocket server
  backend_webhooks: 4002    # Webhooks endpoint

  # Python Services
  ml_engine: 5000           # ML predictions (FastAPI)
  data_service: 5001        # Data sync service
  llm_agent: 5002           # LLM agent API (futuro)
  portfolio_manager: 5003   # Portfolio manager (futuro)

  # Infrastructure
  postgres: 5432            # PostgreSQL principal
  postgres_test: 5433       # PostgreSQL testing
  redis: 6379               # Redis cache/queues
  mysql_legacy: 3306        # MySQL temporal (migración)

  # CI/CD & Monitoring
  jenkins: 8080             # Jenkins CI/CD
  jenkins_agent: 50000      # Jenkins agents
  prometheus: 9090          # Métricas (opcional)
  grafana: 3200             # Dashboards (opcional)

  # Dev Tools
  pgadmin: 5050             # PostgreSQL admin
  mailhog_smtp: 1025        # Email testing SMTP
  mailhog_web: 8025         # Email testing UI

# =============================================================================
# DATABASE
# =============================================================================
database:
  host: "localhost"
  port: 5432
  name: "trading_trading"
  user: "trading_user"
  # password: Ver archivo .env local
  schemas:
    - users                 # Usuarios y autenticación
    - market_data          # Datos de mercado
    - trading              # Señales y operaciones
    - education            # Contenido educativo
    - investment           # Cuentas de inversión
    - payments             # Suscripciones Stripe
    - broker_integration   # Integración brokers
    - data_sources         # Fuentes de datos

# =============================================================================
# REDIS
# =============================================================================
redis:
  host: "localhost"
  port: 6379
  uses:
    - sessions
    - cache
    - message_queues
    - rate_limiting

# =============================================================================
# URLs DE ACCESO
# =============================================================================
urls:
  frontend_web: "http://localhost:3100"
  frontend_admin: "http://localhost:3101"
  backend_api: "http://localhost:4000/api/v1"
  backend_health: "http://localhost:4000/health"
  backend_ws: "ws://localhost:4001"
  ml_engine: "http://localhost:5000"
  ml_engine_docs: "http://localhost:5000/docs"
  data_service: "http://localhost:5001"
  pgadmin: "http://localhost:5050"
  mailhog: "http://localhost:8025"

# =============================================================================
# ARCHIVOS DE CONFIGURACIÓN
# =============================================================================
env_files:
  ports: ".env.ports"                      # Configuración centralizada de puertos
  backend: "apps/backend/.env"
  frontend: "apps/frontend/.env"
  ml_engine: "apps/ml-engine/.env"
  data_service: "apps/data-service/.env"
  docker: "docker-compose.yml"

# =============================================================================
# STACK TECNOLÓGICO
# =============================================================================
stack:
  backend: "Express + TypeScript"
  frontend: "React + TypeScript + Vite"
  database: "PostgreSQL 15"
  cache: "Redis 7"
  ml_engine: "FastAPI + Python + scikit-learn"
  data_service: "Python AsyncIO + APScheduler"
  llm_agent: "FastAPI + LangChain (futuro)"
  orchestration: "Docker Compose"
  ci_cd: "Jenkins (planeado)"

# =============================================================================
# MÓDULOS DEL PROYECTO
# =============================================================================
modules:
  - name: "OQI-001-authentication"
    status: "active"
    description: "Sistema de autenticación multi-factor"

  - name: "OQI-002-education"
    status: "active"
    description: "Plataforma educativa de trading"

  - name: "OQI-003-trading-charts"
    status: "active"
    description: "Visualización de charts y señales"

  - name: "OQI-004-investment-accounts"
    status: "active"
    description: "Gestión de cuentas de inversión"

  - name: "OQI-005-payments-stripe"
    status: "active"
    description: "Suscripciones con Stripe"

  - name: "OQI-006-ml-engine"
    status: "active"
    description: "Motor de predicciones ML"

  - name: "OQI-007-llm-agent"
    status: "planned"
    description: "Asistente inteligente con LLM"

  - name: "OQI-008-portfolio-manager"
    status: "planned"
    description: "Gestión de portafolios"

# =============================================================================
# INTEGRACIONES EXTERNAS
# =============================================================================
integrations:
  - name: "Polygon.io"
    purpose: "Datos de mercado en tiempo real"
    type: "REST API"

  - name: "Massive API"
    purpose: "Datos históricos de forex"
    type: "REST API"

  - name: "MetaAPI.cloud"
    purpose: "Conexión a MT4/MT5"
    type: "Cloud API"

  - name: "Stripe"
    purpose: "Procesamiento de pagos"
    type: "REST API + Webhooks"
    port: 4002

  - name: "Claude AI / OpenAI"
    purpose: "LLM para asistente"
    type: "REST API"
    status: "planned"

# =============================================================================
# NOTAS
# =============================================================================
notes: |
  CONFIGURACIÓN ACTUALIZADA - 2025-12-05

  Cambios realizados:
  - Puertos reorganizados para evitar conflictos con puertos 3000 y 8000 ya en uso
  - Frontend movido de 5173 a 3100 para consistencia
  - Backend movido de 3000 a 4000 para evitar conflicto
  - ML Engine en 5000 (ya configurado)
  - Data Service en 5001
  - Todos los servicios documentados en docs/95-guias-desarrollo/PUERTOS-SERVICIOS.md

  Archivos creados:
  - .env.ports - Configuración centralizada de puertos
  - docker-compose.yml - Orquestación completa
  - docs/95-guias-desarrollo/PUERTOS-SERVICIOS.md - Documentación detallada

  Estado del proyecto:
  - PostgreSQL: Activo en puerto 5432
  - Redis: Activo en puerto 6379
  - Backend: Requiere actualización de puerto en .env
  - Frontend: Requiere actualización de puerto en vite.config
  - ML Engine: Configurado en 5000 (correcto)
  - Data Service: Configurado en 5001 (nuevo)

  Próximos pasos:
  1. Actualizar archivos .env de cada servicio con nuevos puertos
  2. Testear docker-compose up -d
  3. Verificar conectividad entre servicios
  4. Actualizar CI/CD cuando se implemente Jenkins
