<oms-shared-return-product-info
  class="product-info"
  [product]="product()"
  data-what="component"
  data-which="return-product-info"
></oms-shared-return-product-info>

@let taskItem = item();
@let taskActionType = type();

@if (taskActionType === 'UNKNOWN') {
  <div
    data-what="task-list"
    data-which="processing-comment"
    class="processing-comment-unknown"
  >
    {{ processingComment() }}
  </div>
} @else {
  <div class="task-item-infos">
    <div
      data-what="task-list"
      data-which="processing-comment"
      class="processing-comment"
    >
      {{ processingComment() }}
    </div>
    @if (!taskItem?.completed) {
      <button
        class="flex items-center gap-2 self-end"
        type="button"
        uiButton
        color="primary"
        (click)="onActionClick({ type: taskActionType })"
        data-what="button"
        data-which="complete"
      >
        <ng-icon name="isaActionCheck" uiButtonIcon></ng-icon>
        Als erledigt markieren
      </button>
    } @else {
      <span
        class="flex items-center gap-2 text-isa-accent-green isa-text-body-2-bold self-end"
        data-what="info"
        data-which="completed"
      >
        <ng-icon name="isaActionCheck" uiButtonIcon></ng-icon>
        Abgeschlossen
      </span>
    }
  </div>
}

@if (taskActionType === 'UNKNOWN' && !taskItem?.completed) {
  <div class="task-unknown-actions">
    <button
      class="flex items-center"
      type="button"
      uiButton
      color="secondary"
      (click)="onActionClick({ type: taskActionType, updateTo: 'OK' })"
      data-what="button"
      data-which="resellable"
    >
      Ja verkaufsfähig
    </button>
    <button
      class="flex items-center"
      type="button"
      uiButton
      color="secondary"
      (click)="onActionClick({ type: taskActionType, updateTo: 'NOK' })"
      data-what="button"
      data-which="damaged"
    >
      Nein, defekt
    </button>
  </div>
}

@if (displayPrintTolino()) {
  <button
    data-what="button"
    data-which="print-receipt"
    class="tolino-print-cta"
    (click)="onActionClick({ type: taskActionType, actions: taskItem.actions })"
    uiInfoButton
  >
    <span uiInfoButtonLabel>Retourenschein drucken</span>
    <ng-icon name="isaActionPrinter" uiInfoButtonIcon></ng-icon>
  </button>
}
