import {
  IsString,
  IsOptional,
  IsBoolean,
  IsArray,
  MinLength,
  MaxLength,
  IsObject,
} from "class-validator";
import { Layout } from "../types/widget.types";

/**
 * DTO for creating a new user layout
 */
export class CreateLayoutDto {
  @IsString({ message: "name must be a string" })
  @MinLength(1, { message: "name must not be empty" })
  @MaxLength(100, { message: "name must not exceed 100 characters" })
  name!: string;

  @IsOptional()
  @IsBoolean({ message: "isDefault must be a boolean" })
  isDefault?: boolean;

  @IsArray({ message: "layout must be an array" })
  layout!: Layout;

  @IsOptional()
  @IsObject({ message: "metadata must be an object" })
  metadata?: Record<string, unknown>;
}
