import { IsString, IsInt, IsOptional, IsObject, IsArray, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';

export class AttachmentDto {
  @IsString()
  fileName: string;

  @IsString()
  fileUrl: string;

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

  @IsString()
  @IsOptional()
  size?: string;
}

export class SubmitWorkDto {
  @IsInt()
  registrationId: number;

  @IsString()
  title: string;

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

  @IsArray()
  @IsString({ each: true })
  @IsOptional()
  files?: string[];

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

  @IsArray()
  @IsString({ each: true })
  @IsOptional()
  previewUrls?: string[];

  @IsObject()
  @IsOptional()
  aiModelMeta?: any;

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => AttachmentDto)
  @IsOptional()
  attachments?: AttachmentDto[];
}

