import Component from '../../component.js'
import CoEuiIcon from './eui-icon.js'
import CoEuiBadge from './eui-badge.js'
import CoEuiOverlay from './eui-overlay.js'
import CoEuiNotificationItem from './eui-notification-item.js'

export default class CoEuiNotifications extends Component {
  constructor(parent) {
    let selector = 'eui-notifications';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components-next/src/lib/layout/eui-notifications/eui-notifications.component.html
  }
  get euiIconCO() {
    return new CoEuiIcon(this.currentPath);
  }
  get euiBadgeCO() {
    return new CoEuiBadge(this.euiIconCO);
  }
  get euiOverlayCO() {
    return new CoEuiOverlay(this.currentPath);
  }
  get headerTextCenter() {
    let path = '//h4[contains(@class,"eui-u-text-center")]';
    return this.euiOverlayCO.euiOverlayHeaderCO.currentPath + path;
  }
  get textNotifications() {
    let path = '//h4[text()="Notifications"]';
    return this.euiOverlayCO.euiOverlayHeaderCO.currentPath + path;
  }
  get headerToolbar() {
    let path = '//div[contains(@class,"eui-overlay-header-toolbar")]';
    return this.euiOverlayCO.euiOverlayHeaderCO.currentPath + path;
  }
  async closeIcon() {
    return new CoEuiIcon(this.headerToolbar).byAttributeContains('iconClass','eui-icon-close-m');
  }
  get notificationsItems() {
    let path = '//ul[contains(@class,"eui-notifications-items")]';
    return this.euiOverlayCO.euiOverlayBodyCO.currentPath + path;
  }
  async hasItems() {
    return await (await $(this.notificationsItems)).isExisting();
  }
  get euiNotificationItemCO() {
    return new CoEuiNotificationItem(this.notificationsItems);
  }
  get footerTextCenter() {
    let path = '//div[contains(@class,"eui-u-text-center")]';
    return this.euiOverlayCO.euiOverlayFooterCO.currentPath + path;
  }
}


