import Component  from '../component.js';
import DivComponent from '../div.js';
import SpanComponent from '../span.js';
import CoEuiIconSvg from './eui-icon-svg.js'; 

export default class CoEuiTableSortableCol extends Component {
    constructor(parent) {
      let selector = 'th[@sortable]';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-table/sortable-col/eui-table-sortable-col.component.html
    }
    get contentCO() {
      return new DivComponent(this.currentPath).addPredicateClassContains('eui-table__sortable-col-content');
    }
    get sortableIconCO() {
      return new SpanComponent(this.contentCO).addPredicateClassContains('eui-table__sortable-icon');
    }
    get noSortingIconCO(){
      return new CoEuiIconSvg(this.sortableIconCO).byAttributeContains('icon', 'eui-swap-vertical');
    }
    async hasSortAndNotOrder(){
      return await (await this.noSortingIconCO.element()).isExisting();
    }
    get ascendingOrderIconCO(){
      return new CoEuiIconSvg(this.sortableIconCO).byAttributeContains('icon', 'eui-arrow-up');
    }
    async hasSortAsc(){
      return await (await this.ascendingOrderIconCO.element()).isExisting(); 
    }
    get descendingOrderIconCO(){
      return new CoEuiIconSvg(this.sortableIconCO).byAttributeContains('icon', 'eui-arrow-down');
    }
    async hasSortDesc(){
      return await (await this.descendingOrderIconCO.element()).isExisting(); 
    }
}


