import { Pipe, PipeTransform } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

@Pipe({
  name: 'duration',
  standalone: true,
})

// Currently not in use!
export class DurationPipe implements PipeTransform {
  public constructor(public translate: TranslateService) {}
  transform(value: number): string {
    console.log('value', value);
    if (value < 10) {
      var suffix = this.translate.instant('duration.rounds');
      return value + ' ' + suffix;
    } else if (value < 600) {
      var suffix = this.translate.instant('duration.minutes');
      return value / 10 + ' ' + suffix;
    } else if (value < 1440) {
      var suffix = this.translate.instant('duration.hours');
      return value / 600 + ' ' + suffix;
    } else {
      var suffix = this.translate.instant('duration.days');
      return value / 1440 + ' ' + suffix;
    }
  }
}
