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

/**
 * DTO for updating details of a commission contract.
 * Allows partial updates for name, order, and active status.
 */
export class UpdateCommissionContractDto {
  /**
   * Optional: Name of the commission contract.
   * Example: 'Standard Commission Contract'
   */
  @ApiPropertyOptional({
    description: 'Name of the commission contract',
    example: 'Standard Commission Contract',
  })
  @IsOptional()
  @IsString({ message: 'name must be a string' })
  name?: string;

  /**
   * Optional: Order/priority of the commission contract.
   * Example: 1
   */
  @ApiPropertyOptional({
    description: 'Order or priority of the commission contract',
    example: 1,
    default: 0,
  })
  @IsOptional()
  @IsNumber({}, { message: 'order must be a number' })
  order?: number;

  /**
   * Optional: Active status of the commission contract.
   * Typically 1 = active, 0 = inactive.
   * Example: 1
   */
  @ApiPropertyOptional({
    description:
      'Active status of the commission contract (1=active, 0=inactive)',
    example: 1,
    default: 0,
  })
  @IsOptional()
  @IsNumber({}, { message: 'active must be a number' })
  active?: number;
}
