const express = require('express');
const cors = require('cors');
const featuresConfig = require('./features.config');
const imageRoutes = require('./features/image/image.routes');

const app = express();
app.use(cors());
app.use(express.json());

if (featuresConfig.auth) {
  app.use('/api/auth', require('./features/auth/auth.routes'));
}
if (featuresConfig.user) {
  app.use('/api/user', require('./features/user/user.routes'));
}
if (featuresConfig.image) {
  app.use('/gigachat', imageRoutes);
}

app.get('/api/', (req, res) => {
  res.json({ message: 'API root' });
});

module.exports = app; 