services:

  puzzle_create_one:
    build:
      context: ${PUZZLE_ROOT_DIR:-/opt/apps/puzzle}
      dockerfile: Dockerfile
    container_name: puzzle_create_one
    restart: "no"
    networks: [ traefik_net ]
    environment:
      TZ: Europe/Amsterdam
      OUT_DIR: /data/puzzle
      WORDS_PATH: "/app/export_real_words_with_hints.csv"
      LM_STUDIO_BASE_URL: "http://192.168.1.159:1234/v1"
      GENERATE_ON_START: "true"
      START_CLASS: "puzzle.Main"
      SCORES_PATH: "/app/export_real_words_with_hints.csv"
    volumes:
      - puzzles_data:/data/puzzle:rw

  update_hints:
    build:
      context: tools/hint
      dockerfile: Dockerfile
    container_name: update_hints
    command: ["3000"]   # overrides CMD if you want
    restart: "no"
    networks: [ traefik_net ]
    environment:
      TZ: Europe/Amsterdam

      # schedule + batch size
      CRON_SCHEDULE: "*/15 * * * *"
      LIMIT: "3000"

      # DB + LLM (only works if you apply the Java env() tweak above)
      JDBC_URL: "jdbc:postgresql://192.168.1.159:5432/postgres"
      JDBC_USER: "puzzle"
      JDBC_PASS: "heel-goed-wachtwoord"
      OLLAMA_URL: "http://192.168.1.159:8081/v1/chat/completions"
      MODEL: "/models/Hadiseh-Mhd/Mixtral-8x7B-Instruct-v0.1-Q4_K_M-GGUF/mixtral-8x7b-instruct-v0.1.Q4_K_M.gguf"

  puzzle_gen_java:
    build:
      context: ${PUZZLE_ROOT_DIR:-/opt/apps/puzzle}
      dockerfile: Dockerfile
    container_name: puzzle_gen_java
    restart: unless-stopped
    networks: [ traefik_net ]
    environment:
      TZ: Europe/Amsterdam
      OUT_DIR: /data/puzzle
      WORDS_PATH: "/app/export_real_words_with_hints.csv"
      SCORES_PATH: "/app/export_real_words_with_hints.csv"
      PUZZLES_PER_DAY: "3"
      LM_STUDIO_BASE_URL: "http://192.168.1.159:1234/v1"
      THEME_FILTER: "true"
      THEME_MIN_SCORE: "0.6"
    volumes:
      - puzzles_data:/data/puzzle:rw

  puzzle_test:
    build:
      context: ${PUZZLE_ROOT_DIR:-/opt/apps/puzzle}
      dockerfile: Dockerfile
      args:
        PUZZLE_ROWS: 3
        PUZZLE_COLS: 3
    container_name: puzzle_test
    profiles: ["test"]
    environment:
      GENERATE_ON_START: "true"
      START_CLASS: "puzzle.MainTest"
    volumes:
      - puzzles_data:/data/puzzle:rw

volumes:
  puzzles_data:

networks:
  traefik_net:
    external: true
    name: traefik_net
