import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DomainRemissionService } from '@domain/remission';
import { ReceiptItemDTO } from '@swagger/remi';

@Component({
  selector: 'page-shared-shipping-document-details-item',
  templateUrl: 'shipping-document-details-item.component.html',
  styleUrls: ['shipping-document-details-item.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SharedShippingDocumentDetailsItemComponent implements OnInit {
  @Input()
  item: ReceiptItemDTO;

  @Input()
  canRemoveItem: boolean = false;

  @Input()
  loading: boolean = false;

  @Output()
  removeItem = new EventEmitter<ReceiptItemDTO>();

  get title() {
    return [this.item.product.contributors, this.item.product.name].filter((items) => !!items).join(' - ');
  }

  constructor(private _remissionService: DomainRemissionService) {}

  ngOnInit() {}
}
