import { IsEnum, IsIn, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
import { PaginationDto } from '../../../common/dto/pagination.dto';
import { CollectionPartyType } from '../../../entities/payment-collection.entity';

export type PaymentHistoryKind = 'OFFICE' | 'MD';

/**
 * GET /settlements/payment-history — Collect Payment history list.
 * `kind` selects Cash collection vs Cash collection for MD.
 */
export class PaymentHistoryQueryDto extends PaginationDto {
  @IsIn(['OFFICE', 'MD'])
  kind: PaymentHistoryKind;

  /** Filter to one guest (party_type=CUSTOMER). */
  @IsOptional()
  @IsString()
  @MaxLength(20)
  customer_mobile?: string;

  /** Filter to one trip source (party_type=SOURCE). Declared on PaginationDto too. */
  @IsOptional()
  @IsUUID()
  source_id?: string;

  @IsOptional()
  @IsEnum(CollectionPartyType)
  party_type?: CollectionPartyType;

  @IsOptional()
  @IsString()
  @MaxLength(20)
  date_from?: string;

  @IsOptional()
  @IsString()
  @MaxLength(20)
  date_to?: string;

  /** Received currency (falls back to bill currency when receive is unset). */
  @IsOptional()
  @IsUUID()
  currency_id?: string;
}
