module.exports = {
  apps: [
    {
      name: 'qb-payment-api',
      script: './api/server.js',
      instances: 1,
      autorestart: true,
      watch: false,
      max_memory_restart: '256M',
      node_args: '--max-old-space-size=256',
      env: {
        NODE_ENV: 'development',
        PORT: 3000
      },
      env_production: {
        NODE_ENV: 'production',
        PORT: 3000
      },
      merge_logs: true,
      time: true
    },
    {
      name: 'qb-admin-interface',
      script: './admin/server.js',
      instances: 1,
      autorestart: true,
      watch: false,
      max_memory_restart: '512M',
      env: {
        NODE_ENV: 'development',
        ADMIN_PORT: 3001
      },
      env_production: {
        NODE_ENV: 'production',
        ADMIN_PORT: 3001
      },
      log_file: './admin/logs/pm2-admin.log',
      out_file: './admin/logs/pm2-admin-out.log',
      error_file: './admin/logs/pm2-admin-error.log',
      merge_logs: true,
      time: true
    }
  ],

  // Deployment configuration
  deploy: {
    production: {
      user: 'deploy',
      host: 'payment.yourdomain.com',
      ref: 'origin/main',
      repo: 'https://github.com/yourusername/quickbooks-payment-gateway.git',
      path: '/var/www/payment',
      'pre-deploy-local': '',
      'post-deploy': 'npm install && pm2 reload ecosystem.config.js --env production',
      'pre-setup': ''
    }
  }
}; 