services:
  # Backend Protocol - SIBU 2.0
  - type: web
    name: sibu-backend
    env: python
    # Instalamos uv primero, luego sincronizamos dependencias
    buildCommand: "pip install uv && cd backend && uv sync"
    # Iniciamos el servidor de producción con uvicorn
    startCommand: "cd backend && uv run uvicorn app.main:app --host 0.0.0.0 --port $PORT"
    envVars:
      - key: DATABASE_URL
        fromDatabase:
          name: sibu-db
          property: connectionString
      - key: ENVIRONMENT
        value: production
      - key: DEBUG
        value: "false"
      - key: PYTHON_VERSION
        value: 3.13.0
      # Firebase Admin SDK credentials (JSON string of service account)
      # Set this manually in the Render dashboard — do NOT commit the actual value
      - key: FIREBASE_SERVICE_ACCOUNT_JSON
        sync: false

databases:
  - name: sibu-db
    plan: free # El plan gratuito de Render Postgres
