import { Controller, Get, Query, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiBearerAuth } from '@nestjs/swagger';
import { Roles } from '../../roles/roles.decorator';
import { RoleEnum } from '../../roles/roles.enum';
import { RolesGuard } from '../../roles/roles.guard';
import { AdminLogQueryDto } from './dto/admin-log-query.dto';
import { LoggingService } from './logging.service';

@ApiBearerAuth()
@UseGuards(AuthGuard('jwt'), RolesGuard)
@Roles([RoleEnum.admin])
@Controller({ path: 'admin/logs', version: '1' })
export class LogsController {
  constructor(private readonly loggingService: LoggingService) {}

  @Get()
  findLogs(@Query() query: AdminLogQueryDto) {
    return this.loggingService.findLogs(query);
  }
}
