import { Controller, Get, UseGuards } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiSecurity } from '@nestjs/swagger';
import { ApiKeyGuard } from '../../common/guards/api-key.guard';
import { RequireApiTier } from '../../common/decorators/api-tier.decorator';
import { StatsService } from './stats.service';

@ApiTags('stats')
@ApiSecurity('api-key')
@Controller('v1/stats')
@UseGuards(ApiKeyGuard)
export class StatsController {
  constructor(private readonly statsService: StatsService) {}

  @Get()
  @RequireApiTier('public')
  @ApiOperation({ summary: '链统计（TPS/区块高度/活跃地址/券总量）' })
  getStats() {
    return this.statsService.getStats();
  }
}
