import { Injectable } from '@angular/core';
import { PopupService } from 'app/layouts';
import { I<%= entityAngularName %> } from 'app/shared/model/<%= entityModelFileName %>.model';
import { <%= entityAngularName %>DeleteDialogComponent } from './<%= entityFileName %>-delete-dialog.component';

@Injectable()
export class <%= entityAngularName %>DeleteDialogService {

    constructor(private popupService: PopupService) {
    }

    open(callback: Function, list: Array<I<%= entityAngularName %>>) {
        this.popupService.load(<%= entityAngularName %>DeleteDialogComponent, {
            list: list.length !== 1 ? list : null,
            item: list.length === 1 ? list[0] : null,
            callback,
            close: () => {
                this.close();
            }
        });
    }

    close() {
        this.popupService.eject();
    }
}
