const express = require('express');
const path = require('path');

/**
 * Gomoku Game Server Module
 * Single-player strategy game - no socket.io needed
 */
module.exports = function(ioInstance, appInstance) {
    const router = express.Router();
    
    // Serve static files for Gomoku
    if (appInstance) {
        router.use(express.static(path.join(__dirname, '../public')));
        appInstance.use('/games/gomoku', router);
    }
    
    console.log('Gomoku game mounted at /games/gomoku');
    
    return router;
};

// Standalone execution (if needed for development)
if (require.main === module) {
    const app = express();
    const http = require('http');
    const server = http.createServer(app);
    
    app.use(express.static(path.join(__dirname, '../public')));
    
    const PORT = process.env.PORT || 3006;
    server.listen(PORT, () => {
        console.log(`Gomoku standalone server listening on *:${PORT}`);
    });
}
