import { IsEnum, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
import { PaginationDto } from '../../../common/dto/pagination.dto';
import {
  SettlementParty,
  SettlementStatus,
  SettlementType,
} from '../../../entities/payment-settlement.entity';

/**
 * Settlement list filters — combined with PaginationDto's
 * page / limit / search via inheritance. `search` matches settlement
 * id, booking number, guest name or guest mobile (composed at the
 * repo level).
 */
export class SettlementQueryDto extends PaginationDto {
  @IsEnum(SettlementStatus)
  @IsOptional()
  status?: SettlementStatus;

  @IsEnum(SettlementType)
  @IsOptional()
  type?: SettlementType;

  // Phase F: filter customer vs supplier rows so the Settlements page
  // can default to CUSTOMER (the common case) and the Supplier detail
  // page can scope to SUPPLIER without a dedicated endpoint.
  @IsEnum(SettlementParty)
  @IsOptional()
  party_type?: SettlementParty;

  @IsUUID()
  @IsOptional()
  supplier_id?: string;

  @IsUUID()
  @IsOptional()
  destination_id?: string;

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

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