import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsOptional, IsString } from 'class-validator';
import { PaginationQueryDto } from '../../../common/dto/pagination-query.dto';

const ACTOR_TYPES = ['user', 'superadmin', 'system'] as const;

export class AuditQueryDto extends PaginationQueryDto {
  @ApiPropertyOptional({ description: 'Search in action, targetType, targetId, or actorIdentifier' })
  @IsOptional()
  @IsString()
  q?: string;

  @ApiPropertyOptional({ enum: ACTOR_TYPES })
  @IsOptional()
  @IsEnum(ACTOR_TYPES)
  actorType?: (typeof ACTOR_TYPES)[number];

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  targetType?: string;
}
