import { IsOptional, IsInt, Min, IsDateString } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class QueryTrendDto {
  @ApiPropertyOptional({ description: '开始日期', example: '2026-05-01' })
  @IsOptional()
  @IsDateString()
  startDate?: string;

  @ApiPropertyOptional({ description: '结束日期', example: '2026-05-31' })
  @IsOptional()
  @IsDateString()
  endDate?: string;
}

export class QueryDailyReportDto {
  @ApiPropertyOptional({ description: '日期', example: '2026-05-12' })
  @IsOptional()
  @IsDateString()
  date?: string;
}

export class QueryWeeklyReportDto {
  @ApiPropertyOptional({ description: '开始日期', example: '2026-05-06' })
  @IsOptional()
  @IsDateString()
  startDate?: string;

  @ApiPropertyOptional({ description: '结束日期', example: '2026-05-12' })
  @IsOptional()
  @IsDateString()
  endDate?: string;
}

export class QueryMonthlyReportDto {
  @ApiProperty({ description: '年份', example: 2026 })
  @Type(() => Number)
  @IsInt()
  @Min(2020)
  year: number;

  @ApiProperty({ description: '月份', example: 5 })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  month: number;
}
