import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoUxSidebarItemHeader extends Component {
    constructor(parent) {
      let selector = 'div[contains(@class,"sidebar-item__header")]';
      super(parent,selector);
       //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/layout/ux-layout-app-shell/components/ux-layout-sidebar/ux-layout-sidebar-item.component.ts
    }
    async hasTitle() {
      return await elementAttributeContains(this.currentPath, 'class', 'sidebar-item__header--title');
    }
    async isLarge() {
      return await elementAttributeContains(this.currentPath, 'class', 'sidebar-item__header--large');
    }
    async isCurrentRouteActive() {
      return await elementAttributeContains(this.currentPath, 'class', 'sidebar-item__header--active');
    }
    async isDisabled() {
      return await elementAttributeContains(this.currentPath, 'class', 'sidebar-item__header--disabled');
    }
    async isItemTogglingSubitems() {
      return await elementAttributeContains(this.currentPath, 'class', 'sidebar-item__is-toggling-subitems');
    }
    async isCollapsedWithIcon() {
      return await elementAttributeContains(this.currentPath, 'class', 'sidebar-item__collapsed');
    }
    get iconWrapper() {
      let path = '//div[contains(@class,"sidebar-item__header-icon-wrapper")]';
      return this.currentPath + path;
    }
    async hasIconClass() {
      return await (await $(this.iconWrapperIconFw)).isExisting();
    }
    get iconWrapperIconFw() {
      let path = '//span[contains(@class,"ux-icon-fw")]';
      return this.iconWrapper + path;
    }
    get iconWrapperIconCircleThin() {
      let path = '//span[contains(@class,"ux-icon-circle-thin")]';
      return this.iconWrapper + path;
    }
    get labelWrapper() {
      let path = '//div[contains(@class,"sidebar-item__header-label-wrapper")]';
      return this.currentPath + path;
    }
    get labelWrapperLabel() {
      let path = '//div[contains(@class,"sidebar-item__header-label-wrapper-label")]';
      return this.labelWrapper + path;
    }
    get labelWrapperSubLabel() {
      let path = '//div[contains(@class,"sidebar-item__header-label-wrapper-sub-label")]';
      return this.labelWrapper + path;
    }
    async hasSubLabel() {
      return await (await $(this.labelWrapperSubLabel)).isExisting();
    }
    get expandToggle() {
      let path = '//span[contains(@class,"sidebar-item__header-expand-toggle")]';
      return this.currentPath + path;
    }
    get expandToggleIcon() {
      let path = '//span[contains(@class,"ux-icon")]';
      return this.expandToggle + path;
    }
    async hasToggle() {
      return await (await $(this.expandToggleIcon)).isExisting();
    }
    async isExpandedIcon() {
      return await elementAttributeContains(this.expandToggleIcon, 'class', 'ux-icon-angle-down');
    }
}


