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

/**
 * DTO for updating an existing user layout
 * All fields are optional to support partial updates
 */
export class UpdateLayoutDto {
  @IsOptional()
  @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;

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

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