import CoEuiIconSvg from './eui-icon-svg.js'
import Component  from '../component.js'
import DivComponent from '../div.js'
import ThComponent from '../th.js'

export default class CoEuiTableSelectableHeader extends Component {
    constructor(parent) {
      let selector = 'tr[@isSelectableHeader]';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-table/selectable-header/eui-table-selectable-header.component.html
    }
    get cellSelectCO(){
      return new ThComponent(this.currentPath).byClassContains('eui-table__cell-select');
    }
    async isSelectableHeader(){
      return await (await this.cellSelectCO.element()).isExisting();
    }
    get checkboxContainerCO(){
      return new DivComponent(this.cellSelectCO).addPredicateClassContains('eui-table__cell-select-checkbox-container');
    }
    get checkboxOutlineCO(){
      return new CoEuiIconSvg(this.checkboxContainerCO).byAttributeContains('icon', 'eui-checkbox-outline');
    }
    async isNotCheckedAndNotCheckedIndeterminate(){
      return await (await this.checkboxOutlineCO.element()).isExisting();
    }
    get checkboxIntermediateCO(){
      return new CoEuiIconSvg(this.checkboxContainerCO).byAttributeContains('icon', 'eui-checkbox-intermediate');
    }
    async isCheckedIndeterminate(){
      return await (await this.checkboxIntermediateCO.element()).isExisting();
    }
    get checkboxCO(){
      return new CoEuiIconSvg(this.checkboxContainerCO).byAttributeEquals('icon', 'eui-checkbox');
    }
    async isCheckedAndNotCheckedIndeterminate(){
      return await (await this.checkboxCO.element()).isExisting();
    }
}


