import { Type } from 'class-transformer';
import { IsIn, IsInt, IsOptional, IsString, Max, MaxLength, Min } from 'class-validator';
import { Trim } from '../../../common/dto/field-transforms';

export const PLATFORM_AUDIT_ACTIONS = ['CREATE_ORG', 'UPDATE_ORG_PROFILE', 'SUSPEND_ORG', 'UNSUSPEND_ORG', 'INVITE_ORG_ADMIN', 'RESEND_ORG_ADMIN_INVITE'] as const;

export class ListAuditLogsQuery {
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page: number = 1;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(100)
  pageSize: number = 20;

  @Trim()
  @IsOptional()
  @IsString()
  @MaxLength(200)
  q?: string;

  @IsOptional()
  @IsIn(PLATFORM_AUDIT_ACTIONS)
  action?: (typeof PLATFORM_AUDIT_ACTIONS)[number];
}
