import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
import { Duration, getTotalMinutes } from '@app/shared/models-legacy';

@Component({
    selector: 'duration',
    templateUrl: './duration.component.html',
    styleUrls: ['./duration.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class DurationComponent implements OnChanges {
    @Input() duration: Duration;
    clarifying = false;

    ngOnChanges() {
      const minutes = getTotalMinutes(this.duration);

      this.clarifying = minutes < 15;
  }
}
