import { IsDateString, IsOptional, IsIn } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class QueryOnlineHistoryDto {
  @ApiProperty({
    description: '开始时间 (ISO 8601)',
    example: '2025-01-01T00:00:00.000Z',
  })
  @IsDateString()
  startTime: string;

  @ApiProperty({
    description: '结束时间 (ISO 8601)',
    example: '2025-01-01T23:59:59.000Z',
  })
  @IsDateString()
  endTime: string;

  @ApiPropertyOptional({
    description: '数据聚合间隔',
    enum: ['1m', '5m', '1h'],
    default: '5m',
    example: '5m',
  })
  @IsOptional()
  @IsIn(['1m', '5m', '1h'])
  interval?: '1m' | '5m' | '1h';
}
