import { Type } from 'class-transformer';
import { IsDateString, IsIn, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
import { CALENDAR_EVENT_TYPES } from './create-calendar-event.dto';

export class ListCalendarEventsQuery {
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(2000)
  @Max(2100)
  year?: number;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(0)
  @Max(11)
  month?: number; // 0-indexed (0 = Jan, 11 = Dec) to match JavaScript Date

  @IsOptional()
  @IsDateString()
  from?: string;

  @IsOptional()
  @IsDateString()
  to?: string;

  @IsOptional()
  @IsIn(CALENDAR_EVENT_TYPES)
  type?: string;

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