import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNotEmpty, IsNumber } from 'class-validator';

/**
 * DTO used to create a new user settings record.
 *
 * Captures essential information such as the setting name,
 * display order, status, and the user performing the action.
 */
export class CreateUserSettingsDto {
  /**
   * Name of the user setting.
   *
   * Required field:
   * - Must be a non-empty string.
   * - Example: "Theme", "Notification Preferences"
   */
  @IsNotEmpty()
  @IsString()
  @ApiProperty()
  name: string;

  /**
   * Display order of the setting.
   *
   * Required field:
   * - Must be a number.
   * - Determines the order in which settings appear in UI or processing.
   * - Default is 0.
   */
  @IsNotEmpty()
  @IsNumber({}, { message: 'order must be a number' })
  @ApiProperty({ default: 0 })
  order_no: number;

  /**
   * Active status of the setting.
   *
   * Required field:
   * - Must be a number (commonly 0 for inactive, 1 for active).
   * - Default is 0.
   */
  @IsNotEmpty()
  @IsNumber({}, { message: 'active must be a number' })
  @ApiProperty({ default: 0 })
  active: number;

  /**
   * User ID who is creating the setting.
   *
   * Required field:
   * - Must be a number.
   * - Links the setting to the user performing the action.
   */
  @IsNumber({}, { message: 'by_user must be a number' })
  @ApiProperty()
  by_user: number;
}
