import Component  from '../component.js'
import { elementAttributeContains } from '../../core/utils.js'
import TheadComponent from '../thead.js'
import TbodyComponent from '../tbody.js'
import TfootComponent from '../tfoot.js'

export default class CoEuiTable extends Component {
    constructor(parent) {
      let selector = '*[self::eui-table or self::table[@euiTable]]';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-table/eui-table.component.html
    }
    get theadCO() {
      return new TheadComponent(this.currentPath);
    }
    async hasHeader() {
      return await (await this.theadCO.element()).isExisting();
    }
    get tbodyCO() {
      return new TbodyComponent(this.currentPath);
    }
    async hasBody() {
      return await (await this.tbodyCO.element()).isExisting();
    }

    get tfootCO() {
      return new TfootComponent(this.currentPath);
    }
    async hasFooter() {
      return await (await this.tfootCO.element()).isExisting();
    }
    async hasStickyHeader() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--sticky-header');
    }
    async hasStickyColumns() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--sticky-columns');
    }
    async euiTableDraggable() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--draggable');
    }
    async euiTableCompact() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--compact');
    }
    async euiTableBordered() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--bordered');
    }
    async euiTableFixedLayout() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--fixed-layout');
    }
    async euiTableResponsive() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table--responsive');
    }
    async euiTableCards() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-table-cards');
    }


}


