import Component from '../../component.js'
import CdkOverlayContainer from '../../cdk-overlay-container.js';

export default class CoEuiPopover extends Component {
    constructor(parent) {
      let selector = 'eui-popover';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components-next/src/lib/components/eui-popover/eui-popover.component.html?at=support/10.x
    }
    get overlayContainerCO() {
      return new CdkOverlayContainer('//body');
    }
    get overlayPopoverDiv(){
      return this.overlayContainerCO.overlayPane + '//div[contains(@class,"eui-popover")]';
    }
    getOverlayPopoverDivByIndex(index) {
      return  '(' + this.overlayPopoverDiv +  ')[' + index + ']';
    }
    get arrow(){
      return this.overlayPopoverDiv + '//div[contains(@class,"eui-popover__arrow")]';
    }
    get innerArrow(){
      return this.arrow + '//div[contains(@class,"eui-popover__arrow-inner")]';
    }
    get header(){
      return this.overlayPopoverDiv + '//div[contains(@class,"eui-popover__header")]';
    }
    async hasTitle() {
      return await (await $(this.header)).isExisting();
    }
    get title(){
      return this.header + '//div[contains(@class,"eui-popover__header-title")]';
    }
    get closeButton(){
      return this.header + '//div[contains(@class,"eui-popover__header-close")]';
    }
    async hasCloseButton() {
      return await (await $(this.closeButton)).isExisting();
    }
    get closeIcon() {
      return this.closeButton + '//i[contains(@class,"eui-icon-ecl-close")]';
   }
    get content(){
      return this.overlayPopoverDiv + '//div[contains(@class,"eui-popover__content")]';
    }
}


