import { Pipe, PipeTransform } from '@angular/core';
import { StockInfoDTO } from '@swagger/cat';

@Pipe({
  name: 'stockInfos',
})
export class StockInfosPipe implements PipeTransform {
  transform(infos: StockInfoDTO[], ...args: any[]): number {
    return infos?.reduce((sum, si) => sum + si.inStock, 0) || 0;
  }
}
