import { Controller, Get, Req, UseGuards } from "@nestjs/common";
import type { RequestWithUser } from "@bff/modules/auth/auth.types.js";
import { SalesforceReadThrottleGuard } from "@bff/integrations/salesforce/guards/salesforce-read-throttle.guard.js";
import { MeStatusAggregator } from "./me-status.aggregator.js";
import type { MeStatus } from "@customer-portal/domain/dashboard";

@Controller("me")
export class MeStatusController {
  constructor(private readonly meStatus: MeStatusAggregator) {}

  @UseGuards(SalesforceReadThrottleGuard)
  @Get("status")
  async getStatus(@Req() req: RequestWithUser): Promise<MeStatus> {
    return this.meStatus.getStatusForUser(req.user.id);
  }
}
