import { Component, OnInit } from '@angular/core';
import {ContentType, Keyword, Language, Region, Resource, Sector} from "../../model/resource";
import {ResourceService} from "../../service/resource.service";
@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
  resources: Resource[] = [];
  sectors: Sector[] = [];
  regions: Region[] = [];
  contentTypes: ContentType[] = [];
  languages: Language[] = [];
  keywords: Keyword[] = [];

  selectedSectors: Sector[] = [];
  selectedRegions: Region[] = [];
  selectedTypes: ContentType[] = [];
  selectedLanguages: Language[] = [];
  selectedKeywords: Keyword[] = [];
  searchTerm: string = "";
  more= false;


  constructor(private resourceService:ResourceService) { }

  ngOnInit(): void {
    this.sectors = this.resourceService.getAllSectors();
    this.regions = this.resourceService.getAllRegions();
    this.contentTypes = this.resourceService.getAllContentTypes();
    this.languages = this.resourceService.getAllLanguages();
    this.resources = this.resourceService.getAllResources()
    this.keywords = this.resourceService.getAllKeywords()
    }

    public toggleFilters(){
    //kada se zatvore dodatni filteri isprazniti ako je nesto bilo selektovano u tim filterima
    this.more = !this.more;
    }
}
