import { Component, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';

import SharedModule from 'app/shared/shared.module';
import { ITEM_DELETED_EVENT } from 'app/config/navigation.constants';
import { IInputDataUploadLog } from '../input-data-upload-log.model';
import { InputDataUploadLogService } from '../service/input-data-upload-log.service';

@Component({
  standalone: true,
  templateUrl: './input-data-upload-log-delete-dialog.component.html',
  imports: [SharedModule, FormsModule],
})
export class InputDataUploadLogDeleteDialogComponent {
  inputDataUploadLog?: IInputDataUploadLog;

  protected inputDataUploadLogService = inject(InputDataUploadLogService);
  protected activeModal = inject(NgbActiveModal);

  cancel(): void {
    this.activeModal.dismiss();
  }

  confirmDelete(id: number): void {
    this.inputDataUploadLogService.delete(id).subscribe(() => {
      this.activeModal.close(ITEM_DELETED_EVENT);
    });
  }
}
