import { Body, Controller, Get, Post } from "@nestjs/common";
import { CurrentUser } from "../../common/decorators/current-user.decorator";
import { ReportsService } from "./reports.service";
import { Throttle } from "@nestjs/throttler";

@Controller("reports")
export class ReportsController {
  constructor(private readonly reports: ReportsService) {}

  @Get("mine")
  mine(@CurrentUser() user: { sub: string }) { return this.reports.mine(user.sub); }

  @Post()
  @Throttle({ default: { limit: 10, ttl: 60 * 60_000, blockDuration: 60 * 60_000 } })
  create(@CurrentUser() user: { sub: string }, @Body() body: { targetType?: string; targetId?: string; reason?: string; description?: string }) {
    return this.reports.create(user.sub, body);
  }
}
