import Component from '../../component.js'
import CoEuiIcon from './eui-icon.js'
import { elementAttributeContains } from '../../../core/utils.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-next/src/lib/components/eui-table/selectable-row/eui-table-selectable-row.component.html
    }
    get selectableTableData() {
      return this.currentPath + '//td[contains(@class, "eui-u-color-grey-light") and contains(@class, "eui-u-cursor-pointer")]';
    }
    async isSelectable() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table__row--selectable');
    }
    get euiIconCO() {
      return new CoEuiIcon(this.selectableTableData);
    }
    async isChecked() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table__row--selected');
    }
}


