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

@Controller('auth/user')
@UseGuards(JwtAuthGuard)
export class UserController {
  constructor(private readonly userService: UserService) {}

  /**
   * 获取当前用户信息
   * GET /user/profile
   */
  @Get('profile')
  async getProfile(
    @CurrentUser() user: { accountSequence: string },
  ): Promise<{ success: boolean; data: UserProfileResult }> {
    const result = await this.userService.getProfile(user.accountSequence);
    return { success: true, data: result };
  }
}
