import { IsString, IsEnum, IsOptional, IsObject, IsIn, MaxLength } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { NotificationChannel } from '../../../domain/entities/notification.entity';

export class BroadcastDto {
  @ApiProperty({ description: 'Broadcast title', example: 'System Maintenance', maxLength: 200 })
  @IsString()
  @MaxLength(200)
  title: string;

  @ApiProperty({ description: 'Broadcast body', example: 'The platform will undergo scheduled maintenance tonight.' })
  @IsString()
  body: string;

  @ApiProperty({ description: 'Notification channel', enum: NotificationChannel, example: NotificationChannel.IN_APP })
  @IsEnum(NotificationChannel)
  channel: NotificationChannel;

  @ApiPropertyOptional({ description: 'Target user segment', enum: ['all', 'active', 'new'], default: 'all' })
  @IsOptional()
  @IsIn(['all', 'active', 'new'])
  segment?: 'all' | 'active' | 'new';

  @ApiPropertyOptional({ description: 'Additional payload data', example: { priority: 'high' } })
  @IsOptional()
  @IsObject()
  data?: Record<string, any>;
}
