import { IsString, IsNotEmpty, IsOptional, MaxLength, Matches } from 'class-validator'
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'

export class GrantMonthlyBypassDto {
  @ApiProperty({ description: '豁免月份', example: '2024-01' })
  @IsString()
  @IsNotEmpty({ message: '豁免月份不能为空' })
  @Matches(/^\d{4}-\d{2}$/, { message: '月份格式应为YYYY-MM' })
  month: string

  @ApiPropertyOptional({ description: '豁免原因', example: '特殊情况' })
  @IsOptional()
  @IsString()
  @MaxLength(200, { message: '豁免原因最大200字符' })
  reason?: string
}
