import { Component, OnInit } from '@angular/core';
import { ModalService } from '@libs/ui';
import { Subject, Observable } from 'rxjs';

@Component({
  selector: 'app-remission-scan-product-invalid-barcode',
  templateUrl: './remission-scan-product-invalid-barcode.component.html',
  styleUrls: ['./remission-scan-product-invalid-barcode.component.scss'],
})
export class RemissionScanProductInvalidBarcodeComponent implements OnInit {
  id = 'remission-scan-product-invalid-barcode';

  private closeStream$ = new Subject<void>();
  constructor(private modalService: ModalService) {}

  ngOnInit() {}

  public openDialog(): Observable<void> {
    this.modalService.open(this.id);
    return this.closeStream$.asObservable();
  }

  closeDialog() {
    this.closeStream$.next();
    this.modalService.close(this.id);
  }
}
