import {Component} from "@angular/core";
import {properties} from "../../environments/environment";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../utils/piwikHelper";
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";

@Component({
  selector: 'community-sdg',
  template: `
    <sdg [piwikSiteId]="piwikSiteId" [customFilter]="customFilter"></sdg>
  `
})
export class CommunitySdgComponent {
  piwikSiteId;
  communityId;
  customFilter: SearchCustomFilter = null;

  constructor() {
  }

  ngOnInit() {
    this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
    this.piwikSiteId = PiwikHelper.getSiteId(this.communityId);
    this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
  }
}