import { Controller, Get, Query, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { SuperAdminPermissions } from '../../common/decorators/superadmin-permissions.decorator';
import { SuperAdminPermissionsGuard } from '../../common/guards/superadmin-permissions.guard';
import { SuperAdminJwtAuthGuard } from '../../common/guards/super-admin-jwt-auth.guard';
import { AuditService } from './audit.service';
import { AuditQueryDto } from './dto/audit-query.dto';
import { SUPERADMIN_PERMISSIONS } from '../superadmin/superadmin-permissions';

@ApiTags('Audit')
@ApiBearerAuth()
@UseGuards(SuperAdminJwtAuthGuard, SuperAdminPermissionsGuard)
@Controller('audit/superadmin')
export class AuditController {
  constructor(private readonly auditService: AuditService) {}

  @Get('logs')
  @SuperAdminPermissions(SUPERADMIN_PERMISSIONS.AUDIT_READ)
  async listLogs(@Query() query: AuditQueryDto) {
    return this.auditService.listSuperAdminLogs(query);
  }
}
