import { ReapproCalculator, type ReapproResult } from '@domain/services/ReapproCalculator';

export interface GetReapproTreeQuery {
  type: 'get-reappro-tree';
  target: string;
  qty: number;
  repro: Record<string, number>;
  inverted: Record<string, boolean>;
}

const calculator = new ReapproCalculator();

export function createGetReapproTreeHandler() {
  return (query: GetReapproTreeQuery): ReapproResult => {
    return calculator.compute({
      target: query.target,
      qty: query.qty,
      repro: query.repro,
      inverted: query.inverted,
    });
  };
}
