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

/**
 * Sudoku Game Server Module
 * Single-player puzzle game - no socket.io needed
 */
module.exports = function(ioInstance, appInstance) {
    const router = express.Router();
    
    // Serve static files for Sudoku
    if (appInstance) {
        router.use(express.static(path.join(__dirname, '../public')));
        appInstance.use('/games/sudoku', router);
    }
    
    console.log('Sudoku game mounted at /games/sudoku');
    
    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 || 3005;
    server.listen(PORT, () => {
        console.log(`Sudoku standalone server listening on *:${PORT}`);
    });
}
