import { Container, createOverrideContext } from "aurelia-framework";
import { I18N } from "aurelia-i18n";
import { Config } from "../../config";
import { UIInternal } from "../../utils/ui-internal";


export abstract class SideFilter {
  public config: Config = Container.instance.get(Config);
  public i18n = Container.instance.get(I18N);

  setupGuiSideFilter(el: Element) {
    if (false == this.config.agGridConfig.showFilterBox) {
      return;
    }
    let html = '<template>' + this.setupContentGuiSideFilter() + '</template>';
    let sideFilter = UIInternal.compileTemplate(html, this, createOverrideContext(this));
    sideFilter.appendNodesTo(el);
    sideFilter.attached();
  }

  public abstract setupContentGuiSideFilter(): string;
  public abstract resetFilter(): void;

  public getGuiSideFilter(el: Element) {
    this.setupGuiSideFilter(el);
  }
}