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

/**
 * 创建系统维护公告请求
 */
export class CreateMaintenanceDto {
  @ApiProperty({ description: '维护标题', example: '系统升级中' })
  @IsString()
  @MaxLength(100)
  title: string;

  @ApiProperty({ description: '维护说明', example: '系统正在升级，预计10:00恢复服务，请稍候...' })
  @IsString()
  message: string;

  @ApiProperty({ description: '维护开始时间', example: '2025-01-01T10:00:00Z' })
  @IsDateString()
  startTime: string;

  @ApiProperty({ description: '维护结束时间', example: '2025-01-01T12:00:00Z' })
  @IsDateString()
  endTime: string;
}

/**
 * 更新系统维护公告请求
 */
export class UpdateMaintenanceDto {
  @ApiPropertyOptional({ description: '维护标题' })
  @IsOptional()
  @IsString()
  @MaxLength(100)
  title?: string;

  @ApiPropertyOptional({ description: '维护说明' })
  @IsOptional()
  @IsString()
  message?: string;

  @ApiPropertyOptional({ description: '维护开始时间' })
  @IsOptional()
  @IsDateString()
  startTime?: string;

  @ApiPropertyOptional({ description: '维护结束时间' })
  @IsOptional()
  @IsDateString()
  endTime?: string;
}

/**
 * 激活/停用维护公告请求
 */
export class ToggleMaintenanceDto {
  @ApiProperty({ description: '是否激活' })
  @IsBoolean()
  isActive: boolean;
}
