import { Controller, Get } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { LeaderboardApplicationService } from '../../application/services/leaderboard-application.service';
import { LeaderboardStatusResponseDto } from '../dto/leaderboard-config.dto';

/**
 * 龙虎榜公开接口（无需认证）
 * 供移动端查询榜单开关状态
 */
@ApiTags('龙虎榜-公开')
@Controller('leaderboard')
export class LeaderboardPublicController {
  constructor(
    private readonly leaderboardService: LeaderboardApplicationService,
  ) {}

  @Get('status')
  @ApiOperation({ summary: '获取榜单开关状态（公开接口）' })
  @ApiResponse({
    status: 200,
    description: '榜单开关状态',
    type: LeaderboardStatusResponseDto,
  })
  async getStatus() {
    const config = await this.leaderboardService.getConfig();

    return {
      code: 0,
      message: 'success',
      data: {
        dailyEnabled: config.dailyEnabled,
        weeklyEnabled: config.weeklyEnabled,
        monthlyEnabled: config.monthlyEnabled,
      },
    };
  }
}
