import { IsDateString, IsEnum, IsOptional } from 'class-validator';

/**
 * §12d Outstanding Report — which side of the receivable to group by.
 *
 *   CUSTOMER  the guest who travelled (guest_name + guest_mobile)
 *   AGENT     the trip source / channel that originated the booking
 *
 * One endpoint, two lenses, so "who owes us money" is answerable on a
 * single screen instead of one page per party type.
 */
export enum ReceivablesParty {
  CUSTOMER = 'CUSTOMER',
  AGENT = 'AGENT',
}

/**
 * Query for AR / AP aging endpoints. Optional `as_of` snapshots the
 * report to a different date than today — useful for month-end
 * comparisons. Defaults to today server-side when omitted.
 */
export class AgingQueryDto {
  @IsDateString()
  @IsOptional()
  as_of?: string;

  /** AR only. Defaults to CUSTOMER; ignored by the AP endpoint. */
  @IsEnum(ReceivablesParty)
  @IsOptional()
  party?: ReceivablesParty;
}
