services:
  backend:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: siap24-backend
    restart: unless-stopped
    ports:
      - "${APP_PORT:-8080}:3000"
    volumes:
      - ./src:/app/src
      - ./config_runtime.js:/app/config_runtime.js
    environment:
      NODE_ENV: ${NODE_ENV:-production}
      PORT: 3000
      APP_ENV: ${APP_ENV:-local}
      APP_DEBUG: ${APP_DEBUG:-true}
      APP_URL: ${APP_URL:-http://localhost:8080}
      DEFAULT_ORGANIZATION_PHONE: ${DEFAULT_ORGANIZATION_PHONE:-08889997777}
      ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@siap24.local}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin12345}
      ADMIN_NAME: ${ADMIN_NAME:-Administrator}
      ADMIN_SESSION_DAYS: ${ADMIN_SESSION_DAYS:-7}
      DB_CONNECTION: mysql
      DB_HOST: ${DB_HOST:-siap24-mysql}
      DB_PORT: ${DB_PORT:-3306}
      DB_DATABASE: ${DB_DATABASE:-siap24}
      DB_USERNAME: ${DB_USERNAME:-siap24_user}
      DB_PASSWORD: ${DB_PASSWORD:-siap24_pass}
      CORS_ALLOW_ORIGIN: ${CORS_ALLOW_ORIGIN:-http://localhost:5173}
      FONNTE_BASE_URL: ${FONNTE_BASE_URL:-https://api.fonnte.com}
      FONNTE_TIMEOUT_SECONDS: ${FONNTE_TIMEOUT_SECONDS:-15}
      WEBHOOK_WORKER_ENABLED: ${WEBHOOK_WORKER_ENABLED:-true}
      WEBHOOK_JOB_BATCH_SIZE: ${WEBHOOK_JOB_BATCH_SIZE:-10}
      WEBHOOK_JOB_INTERVAL_MS: ${WEBHOOK_JOB_INTERVAL_MS:-1000}
      GATEWAY_OUTBOX_BATCH_SIZE: ${GATEWAY_OUTBOX_BATCH_SIZE:-25}
      GATEWAY_OUTBOX_CONCURRENCY: ${GATEWAY_OUTBOX_CONCURRENCY:-5}
      GATEWAY_OUTBOX_INTERVAL_MS: ${GATEWAY_OUTBOX_INTERVAL_MS:-1000}
      GATEWAY_RETRY_DELAY_SECONDS: ${GATEWAY_RETRY_DELAY_SECONDS:-30}
      KOBOILLM_API_BASE: ${KOBOILLM_API_BASE:-https://api.koboillm.com/v1}
      KOBOILLM_MODEL: ${KOBOILLM_MODEL:-gpt-3.5-turbo}
      KOBOILLM_SYSTEM_PROMPT: ${KOBOILLM_SYSTEM_PROMPT:-Kamu adalah customer service WhatsApp yang sopan, singkat, dan membantu. Jawab berdasarkan FAQ dan knowledge base. Jangan halusinasi.}
      KOBOILLM_TEMPERATURE: ${KOBOILLM_TEMPERATURE:-0.3}
      KOBOILLM_MAX_TOKENS: ${KOBOILLM_MAX_TOKENS:-500}
      KOBOILLM_TIMEOUT_SECONDS: ${KOBOILLM_TIMEOUT_SECONDS:-20}
    networks:
      - siap24_net

networks:
  siap24_net:
    name: siap24_net
