import { Pipe, PipeTransform } from '@angular/core';
import { ShelfHistoryLogDetails } from '../../../defs';

@Pipe({
  name: 'getStatusFromHistory',
})
export class GetStatusFromHistoryPipe implements PipeTransform {
  transform(details: ShelfHistoryLogDetails, statusType: 'new' | 'old' = 'new'): string {
    const defaultValue = '-';
    return statusType === 'old' ? details.previousValue || defaultValue : details.value || defaultValue;
  }
}
