import { Controller, Get, Param, UseGuards } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '../../auth/guards/jwt-auth.guard';
import { RolesGuard } from '../../auth/guards/roles.guard';
import { ModuleGuard } from '../../../common/guards/module.guard';
import { Roles, UserRole } from '../../../common/decorators/roles.decorator';
import { RequireModule } from '../../../common/decorators/require-module.decorator';
import { AnalyticsService } from '../services/analytics.service';

@ApiTags('Telegram Bot — Analytics')
@ApiBearerAuth()
@Controller('telegram-bot/bots/:botId/analytics')
@UseGuards(JwtAuthGuard, RolesGuard, ModuleGuard)
@RequireModule('telegram_bot')
@Roles(UserRole.CLUB_ADMIN, UserRole.SUPER_ADMIN)
export class AnalyticsController {
  constructor(private readonly analytics: AnalyticsService) {}

  @Get()
  async getAnalytics(@Param('botId') botId: string) {
    return this.analytics.getBotAnalytics(botId);
  }
}
