import Component  from '../component.js'
import CoEuiIcon from './eui-icon.js'
import { elementAttributeContains } from '../../core/utils.js';
import TdComponent from '../td.js';

export default class CoEuiTableSelectableRow extends Component {
    constructor(parent) {
      let selector = 'tr[contains(@class, "eui-table__row") and contains(@class, "eui-table__row--selectable")]';
      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=refs%2Fheads%2Fsupport/13.x
    }
    get selectableTableDataCO() {
      return new TdComponent(this.currentPath).byAttributeContains('class','eui-u-color-grey-light');
    }
    async isSelectable() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table__row--selectable');
    }
    get euiIconCO() {
      return new CoEuiIcon(this.selectableTableDataCO);
    }
    async isChecked() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table__row--selected');
    }
}


