import Component  from '../component.js'
import TdComponent from '../td.js'
import DivComponent from '../div.js'
import CoEuiIconSvg from './eui-icon-svg.js'

export default class CoEuiTableSelectableRow extends Component {
    constructor(parent) {
      let selector = 'tr[@isSelectable]';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-table/selectable-row/eui-table-selectable-row.component.html
    }
    get cellSelectCO() {
      return new TdComponent(this.currentPath).byAttributeContains('class','eui-table__cell-select');
    }
    async isSelectable() {
      return await (await this.cellSelectCO.element()).isExisting();
    }
    get selectCheckboxContainerCO(){
      return new DivComponent(this.cellSelectCO).addPredicateClassContains('eui-table__cell-select-checkbox-container');
    }
    get unCheckedIconCO(){
      return new CoEuiIconSvg(this.selectCheckboxContainerCO).byAttributeContains('aria-label', 'Unchecked');
    }
    async notChecked(){
      return await (await this.unCheckedIconCO.element()).isExisting();
    }
    get checkedIconCO(){
      return new CoEuiIconSvg(this.selectCheckboxContainerCO).byAttributeContains('aria-label', 'Checked');
    }    
}


