# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: THE BOSSES PWA
spec:
    description: Deploy THE BOSSES as a complete two-service PWA from GitHub.
    icon: https://raw.githubusercontent.com/joe12882-byte/thebosses/main/frontend/public/icon-192x192.png
    variables:
        - key: BACKEND_DOMAIN
          type: DOMAIN
          name: Backend domain
          description: Generate or select the public domain for the FastAPI backend.
        - key: FRONTEND_DOMAIN
          type: DOMAIN
          name: PWA domain
          description: Generate or select the public domain where users install the PWA.
        - key: MONGO_URL
          type: PASSWORD
          name: MongoDB connection
          description: Private MongoDB Atlas connection string used by the existing application.
        - key: DB_NAME
          type: STRING
          name: Database name
          description: Existing MongoDB database name, normally loyalty_app.
        - key: BUSINESS_REGISTRATION_CODE
          type: PASSWORD
          name: Business registration code
          description: Private code required to register business accounts.
        - key: ADMIN_SECRET_CODE
          type: PASSWORD
          name: Admin secret code
          description: Private code required by administrative endpoints.
        - key: JWT_SECRET
          type: PASSWORD
          name: JWT secret
          description: Private random value used to sign authentication tokens.
    tags:
        - Website
        - Tool
    readme: |-
        # THE BOSSES PWA

        This template creates the backend and frontend automatically from the
        `joe12882-byte/thebosses` GitHub repository.

        - The backend domain is bound to the FastAPI service.
        - The frontend domain is bound to the installable Expo web PWA.
        - The frontend waits for the backend service to start.
        - Private values are stored in Zeabur, never in GitHub.
    services:
        - name: backend
          template: GIT
          spec:
            id: backend
            source:
                source: GITHUB
                repo: 1197482228
                branch: main
                watchPaths:
                    - /backend
                rootDirectory: backend
            ports:
                - id: web
                  port: 8080
                  type: HTTP
            env:
                ADMIN_SECRET_CODE:
                    default: ${ADMIN_SECRET_CODE}
                BACKEND_URL:
                    default: ${ZEABUR_WEB_URL}
                    expose: true
                BUSINESS_REGISTRATION_CODE:
                    default: ${BUSINESS_REGISTRATION_CODE}
                DB_NAME:
                    default: ${DB_NAME}
                JWT_SECRET:
                    default: ${JWT_SECRET}
                MONGO_URL:
                    default: ${MONGO_URL}
                TIMEZONE_OFFSET:
                    default: "-4"
          domainKey: BACKEND_DOMAIN
        - name: frontend
          dependencies:
            - backend
          template: GIT
          spec:
            id: frontend
            source:
                source: GITHUB
                repo: 1197482228
                branch: main
                watchPaths:
                    - /frontend
                rootDirectory: frontend
            ports:
                - id: web
                  port: 8080
                  type: HTTP
          domainKey: FRONTEND_DOMAIN
localization:
    es-ES:
        description: Despliega THE BOSSES automáticamente como PWA con backend y frontend.
        variables:
            - key: BACKEND_DOMAIN
              type: DOMAIN
              name: Dominio del backend
              description: Genera o selecciona el dominio público para FastAPI.
            - key: FRONTEND_DOMAIN
              type: DOMAIN
              name: Dominio de la PWA
              description: Genera o selecciona el dominio donde se instalará la PWA.
            - key: MONGO_URL
              type: PASSWORD
              name: Conexión MongoDB
              description: Cadena privada de MongoDB Atlas usada por la aplicación existente.
            - key: DB_NAME
              type: STRING
              name: Nombre de la base de datos
              description: Nombre de la base MongoDB existente, normalmente loyalty_app.
            - key: BUSINESS_REGISTRATION_CODE
              type: PASSWORD
              name: Código de registro de negocios
              description: Código privado requerido para registrar negocios.
            - key: ADMIN_SECRET_CODE
              type: PASSWORD
              name: Código secreto administrativo
              description: Código privado requerido por los endpoints administrativos.
            - key: JWT_SECRET
              type: PASSWORD
              name: Secreto JWT
              description: Valor privado aleatorio usado para firmar sesiones.
        readme: |-
            # THE BOSSES PWA

            Esta plantilla crea automáticamente backend y frontend desde GitHub,
            enlaza ambos dominios y almacena los secretos únicamente en Zeabur.
