import clubStatisticsService from '../services/clubStatisticsService.js';

class ClubStatisticsController {
  async getClubStatistics(req, res) {
    try {
      const { clubId } = req.params;
      const statistics = await clubStatisticsService.getClubStatistics(clubId);
      res.json(statistics);
    } catch (error) {
      console.error('[getClubStatistics] - Error:', error);
      if (error?.status) {
        return res.status(error.status).json({ error: error.message });
      }
      res.status(500).json({ error: 'Fehler beim Laden der Vereinsstatistiken' });
    }
  }
}

export default new ClubStatisticsController();
