import {
  ArrayNotEmpty,
  IsArray,
  IsBoolean,
  IsInt,
  IsOptional,
  IsString,
  Max,
  MaxLength,
  Min,
} from "class-validator";

export class CreateFileUploadFieldDto {
  @IsString()
  @MaxLength(128)
  fileKey!: string;

  @IsString()
  @MaxLength(256)
  fileLabel!: string;

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

  @IsBoolean()
  isRequired!: boolean;

  @IsBoolean()
  isMultiple!: boolean;

  @IsInt()
  @Min(1)
  @Max(50)
  maxFiles!: number;

  @IsArray()
  @ArrayNotEmpty()
  @IsString({ each: true })
  allowedExtensions!: string[];

  @IsInt()
  @Min(1)
  @Max(500)
  maxSizeMb!: number;

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