import {
  IsString,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsBoolean,
} from 'class-validator';

/**
 * DTO used to define table settings for a user.
 *
 * Captures user-specific preferences for table views, including
 * column configuration and affiliate status.
 */
export class TableSettingsDto {
  /**
   * ID of the user the table settings belong to.
   *
   * Required field:
   * - Must be a number.
   */
  @IsNotEmpty()
  @IsNumber()
  user_id: number;

  /**
   * Type or category of the table settings.
   *
   * Required field:
   * - Must be a string.
   * - Example: "commission_table", "bonus_table", "menu_table".
   */
  @IsNotEmpty()
  @IsString()
  setting_type: string;

  /**
   * Column configuration for the table.
   *
   * Required field:
   * - Must be an array (any[] type here for flexible column structure).
   * - Contains the list of columns and their display properties.
   */
  @IsNotEmpty()
  @IsString()
  columns: any[];

  /**
   * Flag indicating if the table is for an affiliate user.
   *
   * Optional boolean field:
   * - Defaults to false.
   * - Can be used to customize table behavior for affiliates.
   */
  @IsNotEmpty()
  @IsBoolean()
  is_affiliate: boolean = false;
}
