import { IsIn, IsOptional, IsString, ValidateIf, IsObject, IsArray } from 'class-validator';

export class CreateStepDto {
  @IsIn(['video', 'text', 'question', 'questionList', 'teleprompter'])
  type: 'video' | 'text' | 'question' | 'questionList' | 'teleprompter';

  @IsOptional()
  @IsString()
  title?: string;

  @ValidateIf(o => o.type === 'text')
  @IsString()
  content?: string;

  @ValidateIf(o => o.type === 'teleprompter')
  @IsString()
  teleprompterText?: string;

  @ValidateIf(o => o.type === 'question')
  @IsObject()
  questionData?: any;

  // ✅ for type === 'questionList'
  @ValidateIf(o => o.type === 'questionList')
  @IsArray()
  questionsList?: { question: string }[];
}
