import { Type } from 'class-transformer';
import { IsIn, IsInt, IsOptional, IsString, Min } from 'class-validator';

export const ACTIVITY_FILTER_TYPES = ['all', 'CALL', 'MEETING', 'NOTE', 'TASK'] as const;

export class ListActivitiesQuery {
  @IsOptional()
  @IsIn(ACTIVITY_FILTER_TYPES)
  type?: (typeof ACTIVITY_FILTER_TYPES)[number];

  @IsOptional()
  @IsString()
  q?: string;

  @IsOptional()
  @IsString()
  ownerId?: string;

  @IsOptional()
  @IsString()
  leadId?: string;

  @IsOptional()
  @IsString()
  contactId?: string;

  @IsOptional()
  @IsString()
  accountId?: string;

  @IsOptional()
  @IsString()
  dealId?: string;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page?: number = 1;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  limit?: number = 50;
}
