import { Controller, Get, Query, Req, UseGuards } from '@nestjs/common';
import { AuthGuard } from '../auth/auth.guard';
import type { AuthenticatedRequest } from '../auth/types/authenticated-request';
import { AdminLogsService } from './admin-logs.service';

@UseGuards(AuthGuard)
@Controller('api/admin')
export class AdminLogsController {
  constructor(private readonly adminLogsService: AdminLogsService) {}

  @Get('audit-logs')
  listAuditLogs(
    @Req() request: AuthenticatedRequest,
    @Query() query: Record<string, unknown>,
  ) {
    return this.adminLogsService.listAuditLogs(request.user, query);
  }
}
