import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment";


@Component({
    selector: 'openaire-advanced-search-organizations',
    template: `
    <search-organizations [simpleView]="false"   [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false" [searchForm]="{dark: false, class: 'search-form'}">
    </search-organizations>
    `
 })
export class OpenaireAdvancedSearchOrganizationsComponent implements OnInit {
  communityId:string;
  piwikSiteId;
  customFilter: SearchCustomFilter;
  
  constructor () {
  }
  
  ngOnInit() {
        let communityId =  ConnectHelper.getCommunityFromDomain(properties.domain);
        this.piwikSiteId = PiwikHelper.getSiteId(communityId);
        if(communityId){
          this.communityId = communityId;
          this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
          this.customFilter.isHiddenFilter = false;
        }
  }
}
