# Local Development Overrides
# This file is automatically loaded by docker-compose and overrides settings in docker-compose.yml
# Perfect for local development settings that shouldn't be in production

services:
  app:
    environment:
      - APP_ENV=local
      - APP_DEBUG=true
      - COMPOSER_ALLOW_SUPERUSER=1
      - JWT_SECRET=test_jwt_secret_key_for_testing_environment_only_2025
      - QR_SECRET_KEY=test_qr_secret_key_for_hmac_signature_validation_2025
    volumes:
      # Mount source code for hot reloading
      - ./:/var/www
      # Persist composer cache
      - composer-cache:/root/.composer/cache
    # Use default CMD from Dockerfile (supervisord) instead of php-fpm
    # command: (removed - let Dockerfile CMD handle startup)

  mysql:
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
    volumes:
      # Mount initialization scripts
      - ./docker/mysql/init:/docker-entrypoint-initdb.d
      # Persist database between restarts
      - mysql_data:/var/lib/mysql

  horizon:
    environment:
      - APP_ENV=local
      - APP_DEBUG=true
      - HORIZON_ENVIRONMENT=local
    volumes:
      # Enable hot reloading for queue workers
      - ./:/var/www
    command: >
      sh -c "
        while ! nc -z mysql 3306; do
          echo 'Waiting for MySQL...'
          sleep 1
        done &&
        while ! nc -z redis 6379; do
          echo 'Waiting for Redis...'
          sleep 1
        done &&
        php artisan horizon
      "

  chrome:
    environment:
      - DEBUG=browserless:*
      - ENABLE_DEBUGGER=true
      - DEMO_MODE=false
      - BLOCK_ADS=false
    ports:
      - "3333:3000"
      - "9222:9222"  # Chrome DevTools port

  # PhpMyAdmin for database management
  phpmyadmin:
    image: phpmyadmin:latest
    container_name: showprima_phpmyadmin
    environment:
      - PMA_HOST=mysql
      - PMA_PORT=3306
      - PMA_ARBITRARY=1
    ports:
      - "8080:80"
    depends_on:
      - mysql
    networks:
      - showprima_network
    profiles:
      - debug

  # Mailhog for email testing
  mailhog:
    image: mailhog/mailhog:latest
    container_name: showprima_mailhog
    ports:
      - "1025:1025"  # SMTP port
      - "8025:8025"  # Web UI
    networks:
      - showprima_network
    profiles:
      - debug

volumes:
  composer-cache:
    driver: local