import Component  from '../component.js'

class CoUxTreeListItem extends Component {
    constructor(parent) {
      let selector = 'div[@data-e2e="ux-tree-list-item"]';
      super(parent, selector);
    }
    async isExpanded() {
      let at = await (await $(this.headerContent)).getAttribute('aria-expanded');
      if (at === 'true') {
         return true;
      } else if (at === 'false') {
         return false;
      } else {
         throw new Error('Ux Tree List Item component object needs to be revised, ' +
         'Header content is missing atribute');
      }
    }
    get header() {
      let path = '//div[contains(@class,"ux-tree-list-item-header")]';
      return this.currentPath + path;
    }
    get headerContent() {
      let path = '//div[@class ="ux-tree-list-item-header__content"]';
      return this.header + path;
    }
    get headerContentRightContent() {
      let path = '//div[@class = "ux-tree-list-item-header__content-right-content"]';
      return this.headerContent + path;
    }
    get headerContentRightContentSub() {
      let path = '//div[@class = "ux-tree-list-item-header__content-right-content-sub"]';
      return this.headerContentRightContent + path;
    }
    get headerContentExpandToggleWrapper() {
      let path = '//span[@class = "ux-tree-list-item-header__content-expand-toggle-wrapper"]';
      return this.headerContentRightContent + path;
    }
    get headerContentExpandToggle() {
      let path = '//span[@class = "ux-tree-list-item-header__content-expand-toggle"]';
      return this.headerContentExpandToggleWrapper + path;
    }
    get alabelCO() {
      return new CoUxAlabel(this.headerContent);
    }
    get headerDetailsContent() {
      let path = '//div[@class = "ux-tree-list-item-header__details-content"]';
      return this.header + path;
    }
}


