import Component from '../component.js';
import DivComponent from '../div.js';
import CoEuiLabel from './eui-label.js';
import CoEuiTreeListItemContent from './eui-tree-list-item-content.js';
import CoEuiTreeListItemRightContent from './eui-tree-list-item-right-content.js';

export default class CoEuiTreeListItem extends Component {

  constructor(parent) {
    let selector = 'eui-tree-list-item';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-tree-list/eui-tree-list-item.component.html
  }

  get headerCO(){
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-tree-list-item-header');
  }
  get headerContentCO(){
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-tree-list-item-header__content');
  }
  get contentCO(){
    return new CoEuiTreeListItemContent(this.headerContentCO);
  }
  async hasCustomContent(){
    return await (await this.contentCO.element()).isExisting();
  }
  get rightContentCO(){
    return new CoEuiTreeListItemRightContent(this.headerContentCO);
  }
  get noCustomContentDivCO(){
    return new DivComponent(this.headerContentCO).addPredicateClassContains('eui-u-flex');
  }
  get noCustomContentLabelCO(){
    return new CoEuiLabel(this.noCustomContentDivCO);
  }
  get noCustomContentSubLabelCO(){
    return new CoEuiLabel(this.noCustomContentLabelCO).addSelectorPredicate('[@euisublabel]');
  }
  async noCustomLabel(){
    return await (await this.noCustomContentSubLabelCO.element()).isExisting();
  }
  get customLabelDivCO(){
    return new DivComponent(this.noCustomContentDivCO).addPredicateClassContains('eui-u-flex');
  }
  get itemLabel(){
    return this.customLabelDivCO.currentPath + '//eui-tree-list-item-label';
  }
  get noCustomContentRightContentCO(){
    return new CoEuiTreeListItemRightContent(this.headerContentCO);
  }
  get customDetailContentCO(){
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-tree-list-item-header__details-content');
  }
  get itemDetails(){
    return this.customDetailContentCO.currentPath + '//eui-tree-list-item-details';
  }
  async hasCustomDetailContent(){
    return await (await this.customDetailContentCO.element()).isExisting();
  }
  get customSubContainerContent(){
    return this.headerCO.currentPath + '//eui-tree-list-item-sub-container';
  }
  async hasCustomSubContainerContent(){
    return await (await $(this.customSubContainerContent)).isExisting();
  }
}


