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

export enum PnlGroupBy {
  DESTINATION = 'destination',
  SOURCE = 'source',
  SERVICE = 'service',
}

/**
 * Query for the P&L endpoint. Date semantic is `settled_date` — money
 * counted in the period it actually moved, not when it was billed.
 */
export class PnlQueryDto {
  @IsDateString()
  from: string;

  @IsDateString()
  to: string;

  @IsEnum(PnlGroupBy)
  @IsOptional()
  group_by?: PnlGroupBy;
}
