import { Controller, Get, Req, Res, UseGuards } from "@nestjs/common";
import { ApiBearerAuth, ApiTags } from "@nestjs/swagger";
import { Request, Response } from "express";
import { ProgressService } from "./progress.service";
import { UserAuthGuard } from "src/common/guards/jwt-auth.guard";
import { UserDecorator } from "src/common/decorator/user.decorator";

@ApiTags("Progress")
@ApiBearerAuth()
@Controller("progress")
export class ProgressController {
  constructor(private readonly progressService: ProgressService) {}

  // GET /progress/dashboard — all progress page data in one call
  @UseGuards(UserAuthGuard)
  @Get("dashboard")
  async getDashboard(
    @Req() req: Request,
    @Res() res: Response,
    @UserDecorator() user: any,
  ) {
    return this.progressService.getDashboard(req, res, user);
  }
}
