# Windows/WSL2 overlay — replaces docker-compose.prod.yml for Windows deployments
#
# Usage:
#   docker compose -f docker-compose.yml -f docker-compose.windows.yml up -d
#
# Key differences from prod overlay:
#   - No privileged mode or pid:host (no nsenter, no physical drive mounting)
#   - No slave propagation (no host mount namespace sharing)
#   - No X11/display/device mounts (no physical display on WSL2)
#   - Directory-based VideoStore (bind-mount from Windows filesystem via /mnt/)
#   - Capability flags disable Linux-only services (rdafw, dhcpd, chronyd)
#   - Watchtower for auto-updates (same as prod)

services:
  backend:
    environment:
      NVR_LOCAL_NET_SERVICES: ${NVR_LOCAL_NET_SERVICES:-0}
      NVR_HOST_MOUNTS: ${NVR_HOST_MOUNTS:-0}
      NVR_VIDEOSTORE_MAX_GB: ${NVR_VIDEOSTORE_MAX_GB:-0}
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - "${NVR_VIDEOSTORE_PATH:-/opt/dividia/data/videostore}:/videostore"

  engine:
    environment:
      NVR_VIDEOSTORE_MAX_GB: ${NVR_VIDEOSTORE_MAX_GB:-0}
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - "${NVR_VIDEOSTORE_PATH:-/opt/dividia/data/videostore}:/videostore"

  connector:
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - "${NVR_VIDEOSTORE_PATH:-/opt/dividia/data/videostore}:/videostore"

  playback:
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - "${NVR_VIDEOSTORE_PATH:-/opt/dividia/data/videostore}:/videostore"

  viewer:
    environment:
      NVR_SVIEW_MODE: ${NVR_SVIEW_MODE:-0}
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - "${NVR_VIDEOSTORE_PATH:-/opt/dividia/data/videostore}:/videostore"

  watchtower:
    image: containrrr/watchtower:latest
    restart: always
    network_mode: host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /root/.docker/config.json:/config.json:ro
    environment:
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_LABEL_ENABLE=true
      - WATCHTOWER_SCHEDULE=${WATCHTOWER_SCHEDULE:-0 0 2 * * *}
      - DOCKER_API_VERSION=${DOCKER_API_VERSION:-1.44}
    command: --label-enable
