import { IsUUID, IsOptional, IsInt, Min, Max, IsDateString, IsBoolean } from "class-validator";
import { Type } from "class-transformer";

/**
 * DTO for querying events with filters and pagination
 */
export class QueryEventsDto {
  @IsOptional()
  @IsUUID("4", { message: "workspaceId must be a valid UUID" })
  workspaceId?: string;

  @IsOptional()
  @IsUUID("4", { message: "projectId must be a valid UUID" })
  projectId?: string;

  @IsOptional()
  @IsDateString({}, { message: "startFrom must be a valid ISO 8601 date string" })
  startFrom?: Date;

  @IsOptional()
  @IsDateString({}, { message: "startTo must be a valid ISO 8601 date string" })
  startTo?: Date;

  @IsOptional()
  @IsBoolean({ message: "allDay must be a boolean" })
  @Type(() => Boolean)
  allDay?: boolean;

  @IsOptional()
  @Type(() => Number)
  @IsInt({ message: "page must be an integer" })
  @Min(1, { message: "page must be at least 1" })
  page?: number;

  @IsOptional()
  @Type(() => Number)
  @IsInt({ message: "limit must be an integer" })
  @Min(1, { message: "limit must be at least 1" })
  @Max(100, { message: "limit must not exceed 100" })
  limit?: number;
}
