import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ListViewEventData } from 'nativescript-ui-listview';
import { WarehouseAllOutput } from '../../entities/output/warehouseAllOutput';

@Component({
    selector: 'WarehouseUnitList',
    moduleId: module.id,
    templateUrl: './warehouse-unit-list-view.component.html',
    styleUrls: ['./warehouse-unit-list-view.component.scss']
})

export class WarehouseUnitListComponent {
    @Input() warehouses: WarehouseAllOutput[];
    @Output() tapItem = new EventEmitter<WarehouseAllOutput>();

    templateSelector(item: any, index: number, items: any): string {
        return 'default';
    }

    onTapItem(event: ListViewEventData) {
        this.tapItem.emit(this.warehouses[event.index]);
    }
}
