import { Controller, Get, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '@/shared/guards/jwt-auth.guard';
import { CurrentUser } from '@/shared/decorators/current-user.decorator';
import { CapabilityService } from '@/application/services/capability.service';

/**
 * 用户端能力权限 API
 */
@Controller('auth/user')
@UseGuards(JwtAuthGuard)
export class CapabilityController {
  constructor(private readonly capabilityService: CapabilityService) {}

  /**
   * 获取当前用户的能力权限列表
   * mining-app 登录后调用此接口获取能力状态
   */
  @Get('capabilities')
  async getCapabilities(
    @CurrentUser('accountSequence') accountSequence: string,
  ) {
    return this.capabilityService.getCapabilities(accountSequence);
  }
}
