import  Component from '../component.js';
import  TdComponent from '../td.js';
import  DivComponent from '../div.js';
import  CoEuiInputCheckbox from './eui-input-checkbox.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?at=master
    }
    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 checkedCheckboxCO(){
      return new CoEuiInputCheckbox(this.selectCheckboxContainerCO).byAttributeContains('aria-label', 'default checkbox checked');
    }
    async isChecked(){
      return await (await this.checkedCheckboxCO.element()).isExisting();
    }
    get uncheckedCheckboxCO(){
      return new CoEuiInputCheckbox(this.selectCheckboxContainerCO).byAttributeContains('aria-label', 'default checkbox unchecked');
    }
}
