const express = require('express');
require('dotenv').config();
const cors = require('cors');

const importRoutes = require('./routes/importRoutes');
const collectionRoutes = require('./routes/collectionRoutes');
const exportCardsRoutes = require('./routes/exportCardsRoutes');
const cardImageRoutes = require('./routes/cardImageRoutes');
const versionRoutes = require('./routes/versionRoutes');

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

app.get('/health', (_req, res) => res.json({ status: 'ok' }));

app.use('/import', importRoutes);
app.use('/collection', collectionRoutes);
app.use('/exportCards', exportCardsRoutes);
app.use('/cardImage', cardImageRoutes);
app.use('/db-version', versionRoutes);

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});
