import  Component from '../component.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?at=master
    }
    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 isResponsive() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--responsive")]')).isExisting();
    }
    async isFixedLayout() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--fixed-layout")]')).isExisting();
    }
    async isBordered() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--bordered")]')).isExisting();
    }
    async isCompact() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--compact")]')).isExisting();
    }
    async isDraggable() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--draggable")]')).isExisting();
    }
    async hasCards() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--cards")]')).isExisting();
    }
    async hasStickyHeader() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--sticky-header")]')).isExisting();
    }
    async hasStickyColumns() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-table--sticky-columns")]')).isExisting();
    }
}
