import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';

import { Dataset } from "../../metamodel/model";

@Component({
    selector: 'app-datasets-by-project',
    templateUrl: 'datasets-by-projet.component.html',
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class DatasetsByProjetComponent {
    @Input() projectLabel: string;
    @Input() datasetList: Dataset[];
    @Input() isAllSelected: boolean;
    @Input() isAllUnselected: boolean;
    @Output() change: EventEmitter<number[]> = new EventEmitter();

    // getAttributeListSortedByDisplay() {
    //     return this.attributeList
    //         .sort((a, b) => a.output_display - b.output_display);
    // }
    //
    // isSelected(id: number) {
    //     return this.outputList.filter(i => i === id).length > 0;
    // }
    //
    // toggleSelection(attributeId: number): void {
    //     const clonedOutputList = [...this.outputList];
    //     const index = clonedOutputList.indexOf(attributeId);
    //     if (index > -1) {
    //         clonedOutputList.splice(index, 1);
    //     } else {
    //         clonedOutputList.push(attributeId);
    //     }
    //     this.change.emit(clonedOutputList);
    // }
    //
    // selectAll(): void {
    //     const clonedOutputList = [...this.outputList];
    //     const attributeListId = this.attributeList.map(a => a.id);
    //     attributeListId.filter(id => clonedOutputList.indexOf(id) === -1).forEach(id => {
    //         clonedOutputList.push(id);
    //     });
    //     this.change.emit(clonedOutputList);
    // }
    //
    // unselectAll(): void {
    //     const clonedOutputList = [...this.outputList];
    //     const attributeListId = this.attributeList.map(a => a.id);
    //     attributeListId.filter(id => clonedOutputList.indexOf(id) > -1).forEach(id => {
    //         const index = clonedOutputList.indexOf(id);
    //         clonedOutputList.splice(index, 1);
    //     });
    //     this.change.emit(clonedOutputList);
    // }
}