import { ButtonVariation } from '@af/digi-ng/_button/button';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { AvropCompact } from '@msfa-models/avrop.model';
import { Handledare } from '@msfa-models/handledare.model';

@Component({
  selector: 'msfa-avrop-row',
  templateUrl: './avrop-row.component.html',
  styleUrls: ['./avrop-row.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AvropRowComponent {
  @Input() avrop: AvropCompact;
  @Input() isSelected: boolean;
  @Input() isLocked: boolean;
  @Input() isSubmitted: boolean;
  @Input() handledare: Handledare;
  @Input() handledareConfirmed: boolean;
  @Output() toggled = new EventEmitter<boolean>();
  @Output() deleted = new EventEmitter<void>();

  readonly ButtonVariation = ButtonVariation;

  emitToggle(isSelected: boolean): void {
    this.toggled.emit(isSelected);
  }

  emitDelete(): void {
    this.deleted.emit();
  }
}
