import { IsString, IsOptional, IsNumber, IsEnum, IsDateString, IsObject } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { NoticeType } from '../notice.entity';

export class CreateNoticeDto {
  @ApiProperty({ description: '通知标题' })
  @IsString()
  title: string;

  @ApiProperty({ description: '通知内容' })
  @IsString()
  content: string;

  @ApiPropertyOptional({ enum: NoticeType, description: '通知类型' })
  @IsOptional()
  @IsEnum(NoticeType)
  type?: NoticeType;

  @ApiPropertyOptional({ description: '接收者用户ID，不填表示广播' })
  @IsOptional()
  @IsNumber()
  userId?: number;

  @ApiPropertyOptional({ description: '发送者用户ID' })
  @IsOptional()
  @IsNumber()
  senderId?: number;

  @ApiPropertyOptional({ description: '计划发送时间' })
  @IsOptional()
  @IsDateString()
  scheduledAt?: string;

  @ApiPropertyOptional({ description: '额外元数据' })
  @IsOptional()
  @IsObject()
  metadata?: Record<string, any>;
}