import Component from '../../component.js'
import CoUxPanel from './ux-panel.js'
import CoUxAlabel from './ux-a-label.js'
import CoUxListItems from './ux-list-items.js'

export default class CoUxActionBox extends Component {
    constructor(parent) {
      let selector = 'ux-action-box';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-action-box/ux-action-box.component.html?at=support/10.x
    }
    get dataE2E() {
      let path = '//div[@data-e2e="ux-action-box"]';
      return this.currentPath + path;
    }
    // CONTENT
    get boxContent() {
      let path = '//div[contains(@class,"ux-action-box__content")]';
      return this.currentPath + path;
    }
    // ACTIONS
    get boxActions() {
      let path = '//div[contains(@class,"ux-action-box__actions")]';
      return this.dataE2E + path;
    }
    async isLeftPositioned() {
      return await (await $(this.boxActions + '/self::div[contains(@class,"ux-action-box__actions--left-positioned")]')).isExisting();
    }
    async isExpanded() {
      return !(await (await $(this.boxActions + '/self::div[contains(@class,"ux-action-box__actions--collapsed")]')).isExisting());
    }
    get panelCO(){
      return new CoUxPanel(this.dataE2E);
    }
    get actionBoxPanelLabelCO() {
      return new CoUxAlabel(this.panelCO.panelHeaderPlaceholder);
    }
    get actionBoxIconToggle() {
      let path = '//span[contains(@class,"ux-action-box__icon-toggle")]';
      return this.panelCO.panelHeaderPlaceholder + path;
    }
    get listItemsCO() {
      return new CoUxListItems(this.panelCO.dataE2E);
    }
}


