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

export class CreateBroadcastDto {
  @ApiProperty()
  @IsString()
  botId: string;

  @ApiProperty()
  @IsString()
  name: string;

  @ApiProperty({ description: '{ text, image?, buttons? }' })
  @IsObject()
  message: Record<string, unknown>;

  @ApiProperty({ description: 'Audience filters' })
  @IsObject()
  filters: Record<string, unknown>;

  @ApiPropertyOptional()
  @IsOptional()
  @IsDateString()
  scheduledAt?: string;
}

export class UpdateBroadcastDto {
  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  name?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsObject()
  message?: Record<string, unknown>;

  @ApiPropertyOptional()
  @IsOptional()
  @IsObject()
  filters?: Record<string, unknown>;

  @ApiPropertyOptional()
  @IsOptional()
  @IsDateString()
  scheduledAt?: string | null;
}

export class PreviewCountDto {
  @ApiProperty()
  @IsString()
  botId: string;

  @ApiProperty()
  @IsObject()
  filters: Record<string, unknown>;
}
