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

// import { Family, Category, Attribute } from '../../../metamodel/model';
// import { sortByDisplay } from '../../../shared/utils';
import { Dataset } from "../../metamodel/model";

@Component({
    selector: 'app-dataset-list',
    templateUrl: 'dataset-list.component.html',
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class DatasetListComponent {
    @Input() datasetList: Dataset[];
    @Output() updateDatasetList: EventEmitter<string[]> = new EventEmitter();

    // getCategoryByFamilySortedByDisplay(idFamily: number): Category[] {
    //     return this.categoryList
    //         .filter(category => category.id_output_family === idFamily)
    //         .sort(sortByDisplay);
    // }
    //
    // getAttributeByCategory(idCategory: number): Attribute[] {
    //     return this.datasetAttributeList
    //         .filter(attribute => attribute.id_output_category === idCategory);
    // }
    //
    // getIsAllSelected(idCategory: number): boolean {
    //     const attributeListId = this.getAttributeByCategory(idCategory).map(a => a.id);
    //     const filteredOutputList = this.outputList.filter(id => attributeListId.indexOf(id) > -1);
    //     return attributeListId.length === filteredOutputList.length;
    // }
    //
    // getIsAllUnselected(idCategory: number): boolean {
    //     const attributeListId = this.getAttributeByCategory(idCategory).map(a => a.id);
    //     const filteredOutputList = this.outputList.filter(id => attributeListId.indexOf(id) > -1);
    //     return filteredOutputList.length === 0;
    // }
    //
    // emitChange(clonedOutputList: number[]): void {
    //     this.change.emit(
    //         this.datasetAttributeList
    //             .filter(a => clonedOutputList.indexOf(a.id) > -1)
    //             .sort((a, b) => a.output_display - b.output_display)
    //             .map(a => a.id)
    //     );
    // }
}