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/core/src/lib/commons/ux-components/ux-filter/ux-filter.component.html?at=refs%2Fheads%2Fsupport%2F7.x
    }
    // -- FILTER SELECTOR -- (Save filter button)
    get filterSelectorPlaceholder() {
      let path = '//div[contains(@class,"ux-filter__filter-selector")]';
      return this.currentPath + path;
    }
    // -- QUICK FILTER --
    get quickFilterHeader() {
      let path = '//div[contains(@class,"ux-filter__quick-filter-header")]';
      return this.currentPath + path;
    }
    get quickFilterTitle() {
      let path = '//div[@class = "ux-filter__section-title"]';
      return this.quickFilterHeader + path;
    }
    get quickFilterBody() {
      let path = '//div[contains(@class, "ux-filter__quick-filter-body")]';
      return this.currentPath + path;
    }
    // -- NAVIGATION FILTER --
    get navigationFilterHeader() {
      let path = '//div[contains(@class, "ux-filter__navigation-filter-header")]';
      return this.currentPath + path;
    }
    get navigationFilterTitle() {
      let path = '//div[@class = "ux-filter__section-title"]';
      return this.navigationFilterHeader + path;
    }
	get navigationFilterSwitch() {
      return new CoUxSwitch(this.navigationFilterHeader);
    }
    get navigationFilterBody() {
      let path = '//div[contains(@class, "ux-filter__navigation-filter-body")]';
      return this.currentPath + path;
    }
    async isNavigationFilterExpanded() {
      return await (await $(this.navigationFilterBody)).isExisting();
    }
	
    // -- ADVANCED FILTER --
    get advancedFilterHeader() {
      let path = '//div[contains(@class, "ux-filter__advanced-filter-header")]';
      return this.currentPath + path;
    }
    get advancedFilterTitle() {
      let path = '//div[@class = "ux-filter__section-title"]';
      return this.advancedFilterHeader + path;
    }
	get advancedFilterSwitch() {
      return new CoUxSwitch(this.advancedFilterHeader);
    }
    get advancedFilterBody() {
      let path = '//div[contains(@class, "ux-filter__advanced-filter-body")]';
      return this.currentPath + path;
    }
    async isAdvancedFilterExpanded() {
      return await (await $(this.advancedFilterBody)).isExisting();
    }
}


