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

/**
 * DTO used to update existing user settings.
 *
 * All fields are optional, allowing partial updates
 * of the user setting record.
 */
export class UpdateUserSettingsDto {
  /**
   * Name of the user setting.
   *
   * Optional field:
   * - Must be a string if provided.
   * - Updates the display or functional name of the setting.
   */
  @IsOptional()
  @IsString()
  @ApiPropertyOptional()
  name?: string;

  /**
   * Order or sequence number of the user setting.
   *
   * Optional field:
   * - Must be a number if provided.
   * - Determines the display or processing order of this setting.
   * - Default is 0 if not specified.
   */
  @IsOptional()
  @IsNumber({}, { message: 'order must be a number' })
  @ApiPropertyOptional({ default: 0 })
  order_no?: number;

  /**
   * Active status of the user setting.
   *
   * Optional field:
   * - Must be a number if provided (commonly 0 for inactive, 1 for active).
   * - Default is 0 if not specified.
   */
  @IsOptional()
  @IsNumber({}, { message: 'active must be a number' })
  @ApiPropertyOptional({ default: 0 })
  active?: number;
}
