import { OmitType } from '@nestjs/mapped-types';
import { IsIn, IsOptional, IsString, MaxLength } from 'class-validator';
import { CollectPaymentDto } from './collect-payment.dto';
import { type PaymentHistoryKind } from './payment-history-query.dto';

/**
 * PATCH /settlements/payment-history/:id
 *
 * Party, customer, agent, and collection tab are locked — those fields
 * from CollectPaymentDto are omitted so the pipe rejects them.
 */
export class UpdatePaymentHistoryDto extends OmitType(CollectPaymentDto, [
  'party_type',
  'customer_mobile',
  'source_id',
  'customer_name',
] as const) {
  @IsIn(['OFFICE', 'MD'])
  kind: PaymentHistoryKind;

  /** MD collector — free-text driver when no driver master is picked. */
  @IsOptional()
  @IsString()
  @MaxLength(255)
  driver_name?: string;
}
