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

/**
 * DTO for updating a commission contract's basic properties.
 *
 * All fields are optional; only the provided fields will be updated.
 */
export class UpdateCommissionContractDto {
  /**
   * Optional new name for the commission contract.
   * Must be a string if provided.
   */
  @IsOptional()
  @IsString()
  @ApiPropertyOptional()
  name?: string;

  /**
   * Optional order value for sorting or prioritization.
   * Must be a number if provided.
   * Default is 0.
   */
  @IsOptional()
  @IsNumber({}, { message: 'order must be a number' })
  @ApiPropertyOptional({ default: 0 })
  order?: number;

  /**
   * Optional active status of the commission contract.
   * Must be a number (e.g., 0 or 1) if provided.
   * Default is 0.
   */
  @IsOptional()
  @IsNumber({}, { message: 'active must be a number' })
  @ApiPropertyOptional({ default: 0 })
  active?: number;
}
