import {
  IsIn,
  IsInt,
  IsNotEmpty,
  IsObject,
  IsOptional,
  IsString,
  MaxLength,
  Min,
} from 'class-validator';

/** Activity types the visual builder offers (section 12 of the requirements). */
export const ACTIVITY_TYPES = [
  'READING',
  'IMAGE',
  'VIDEO',
  'DRAWING',
  'COLOURING',
  'TRACING',
  'ANNOTATION',
  'MEASUREMENT',
  'QUIZ',
  'MCQ',
  'DECISION_TREE',
  'CASE_SCENARIO',
  'PROCEDURE_STEPS',
  'REFLECTION',
  'CHECKLIST',
  'REFERENCE',
] as const;

export class CreateActivityDto {
  @IsInt()
  lessonId!: number;

  @IsIn(ACTIVITY_TYPES as unknown as string[])
  type!: string;

  @IsString()
  @IsNotEmpty()
  @MaxLength(255)
  title!: string;

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

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

  /** Type-specific settings; the Flutter widget for `type` consumes this verbatim. */
  @IsOptional()
  @IsObject()
  config?: Record<string, any>;

  @IsOptional()
  @IsInt()
  @Min(0)
  orderIndex?: number;
}
