import { Component } from '@angular/core';
import { PopupBaseComponent } from '@app_core/components/popup-base/popup-base.component';
import { WindreamSearch } from '@app_models/windream-search';
import { WindreamSearchToDepartment } from '@app_models/windream-search-to-department';
import { DepartmentDataService } from '@app_modules/department/department-data.service';

@Component({
  selector: 'app-department-windream-search-popupedit',
  templateUrl: './department-windream-search-popupedit.component.html',
  styleUrls: ['./department-windream-search-popupedit.component.scss']
})
export class DepartmentWindreamSearchPopupeditComponent extends PopupBaseComponent {

  constructor(
    public departmentDataService: DepartmentDataService,
  ) {
    super();
    this.departmentDataService.windreamSearchList.load();
  }


  public get windreamSearchList(): WindreamSearch[] {
    return this.departmentDataService.windreamSearchList.items;
  }

  public get focusedItem(): WindreamSearchToDepartment {
    return <WindreamSearchToDepartment>(this._focusedItem);
  }

  getNotUsedWindreamSearches = (dep: WindreamSearch) => {
    return !this.list.items.find((item) => item['windreamSearchId'] === dep.entityId);
  }

}
