import Component from '../../component.js'
import CoUxSwitch from './ux-switch.js'

export default class CoUxFilter extends Component {
    constructor(parent) {
      let selector = 'ux-filter';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-filter/ux-filter.component.html
    }
    get dataE2E() {
      let path = '//div[@data-e2e="ux-filter"]';
      return this.currentPath + path;
    }
    // -- FILTER SELECTOR -- (Save filter button)
    get filterSelectorPlaceholder() {
      let path = '//div[contains(@class,"ux-filter__filter-selector")]';
      return this.dataE2E + path;
    }
    async isCustomFilterSelectorContent() {
      return await (await $(this.filterSelectorPlaceholder)).isExisting();
    }
    // -- QUICK FILTER --
    get quickFilterHeader() {
      let path = '//div[contains(@class,"ux-filter__quick-filter-header")]';
      return this.dataE2E + path;
    }
    async isCustomQuickFilterContent() {
      return await (await $(this.quickFilterHeader)).isExisting();
    }
    get quickFilterTitle() {
      let path = '//div[contains(@class,"ux-filter__section-title")]';
      return this.quickFilterHeader + path;
    }
    get quickFilterBodyPlaceholder() {
      let path = '//div[contains(@class, "ux-filter__quick-filter-body")]';
      return this.dataE2E + path;
    }
    // -- NAVIGATION FILTER --
    get navigationFilterHeader() {
      let path = '//div[contains(@class, "ux-filter__navigation-filter-header")]';
      return this.dataE2E + path;
    }
    async isCustomNavigationFilterContent() {
      return await (await $(this.navigationFilterHeader)).isExisting();
    }
    get navigationFilterTitle() {
      let path = '//div[contains(@class,"ux-filter__section-title")]';
      return this.navigationFilterHeader + path;
    }
    get navigationFilterHeaderDiv() {
      let path = '//div[contains(@class,"ml-auto")]';
      return this.navigationFilterHeader + path;
    }
    get navigationFilterSwitchCO() {
      return new CoUxSwitch(this.navigationFilterHeaderDiv);
    }
    get navigationFilterBodyPlaceholder() {
      let path = '//div[contains(@class, "ux-filter__navigation-filter-body")]';
      return this.dataE2E + path;
    }
    async isNavigationFilterExpanded() {
      return await (await $(this.navigationFilterBodyPlaceholder)).isExisting();
    }
    // -- ADVANCED FILTER --
    get advancedFilterHeader() {
      let path = '//div[contains(@class, "ux-filter__advanced-filter-header")]';
      return this.dataE2E + path;
    }
    async isCustomAdvancedFilterContent() {
      return await (await $(this.advancedFilterHeader)).isExisting();
    }
    get advancedFilterTitle() {
      let path = '//div[contains(@class,"ux-filter__section-title")]';
      return this.advancedFilterHeader + path;
    }
    get advancedFilterHeaderDiv() {
      let path = '//div[contains(@class, "ml-auto")]';
      return this.advancedFilterHeader + path;
    }
    get advancedFilterSwitchCO() {
      return new CoUxSwitch(this.advancedFilterHeaderDiv);
    }
    get advancedFilterBodyPlaceholder() {
      let path = '//div[contains(@class, "ux-filter__advanced-filter-body")]';
      return this.currentPath + path;
    }
    async isAdvancedFilterExpanded() {
      return await (await $(this.advancedFilterBodyPlaceholder)).isExisting();
    }
}


