import Component  from '../component.js'
import CoEuiBadge from './eui-badge.js'
import CoEuiOverlay from './eui-overlay.js'
import CoEuiNotificationItem from './eui-notification-item.js'
import CoEuiButton from './eui-button.js'
import CoEuiIconSvg from './eui-icon-svg.js'
import DivComponent from '../div.js'
import SpanComponent from '../span.js'
import UlComponent from '../ul.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/layout/eui-notifications/eui-notifications.component.html
  }
  get euiIconCO() {
    return new CoEuiIconSvg(this.currentPath).byAttributeContains('class', 'eui-notifications__trigger');
  }
  get euiIconBadgeCO() {
    return new CoEuiBadge(this.euiIconCO);
  }
  async hasCount() {
    return await (await this.euiIconBadgeCO.element()).isExisting();
  }
  get euiOverlayCO() {
    return new CoEuiOverlay(this.currentPath);
  }
  get headerTitleCO() {
    return new DivComponent(this.euiOverlayCO.euiOverlayHeaderCO).addPredicateClassContains('eui-notifications__header-title');
  }
  get headerTitleLabelCO() {
    return new DivComponent(this.headerTitleCO).addPredicateClassContains('eui-notifications__header-title-label');
  }
  get cursorCO() {
    return new SpanComponent(this.headerTitleLabelCO).addPredicateClassContains('eui-u-cursor-help');
  }
  async hasItems() {
    return await (await this.cursorCO.element()).isExisting();
  }
  get euiTitleBadgeCO() {
    return new CoEuiBadge(this.headerTitleLabelCO);
  }
  get headerActionsCO() {
    return new DivComponent(this.euiOverlayCO.euiOverlayHeaderCO).addPredicateClassContains('eui-notifications__header-actions')
  }
  get markAllAsReadHeaderButtonCO() {
    return new CoEuiButton(this.headerActionsCO).byChildSelector('eui-icon-svg[contains(@class, "eui-checkmark-done")]');
  }
  get markAllAsReadHeaderIconCO() {
    return new CoEuiIconSvg(this.markAllAsReadHeaderButtonCO);
  }
  async isShowMarkAllAsReadButton() {
    return await (await this.markAllAsReadHeaderButtonCO.element()).isExisting();
  }
  get settingsHeaderButtonCO() {
    return new CoEuiButton(this.headerActionsCO).byChildSelector('eui-icon-svg[contains(@class, "eui-settings")]');
  }
  get settingsHeaderIconCO() {
    return new CoEuiIconSvg(this.settingsHeaderButtonCO);
  }
  async isShowSettingsButton() {
    return await (await this.settingsHeaderButtonCO.element()).isExisting();
  }
  get refreshHeaderButtonCO() {
    return new CoEuiButton(this.headerActionsCO).byChildSelector('eui-icon-svg[contains(@class, "eui-refresh")]');
  }
  get refreshHeaderIconCO() {
    return new CoEuiIconSvg(this.refreshHeaderButtonCO);
  }
  async isShowRefreshButton() {
    return await (await this.refreshHeaderButtonCO.element()).isExisting();
  }
  get notificationsItemsCO() {
    return new UlComponent(this.euiOverlayCO.euiOverlayBodyCO).addPredicateClassContains('eui-notifications-items');
  }
  async hasNotificationsItems() {
    return await (await this.notificationsItemsCO.element()).isExisting();
  }
  get euiNotificationItemCO() {
    return new CoEuiNotificationItem(this.notificationsItemsCO);
  }
  get footerLabel() {
    let path = '//strong//a';
    return this.euiOverlayCO.euiOverlayFooterCO.currentPath + path;
  }
  get footerItemContentCO() {
    return new DivComponent(this.euiOverlayCO.euiOverlayFooterCO).addPredicateClassContains('ux-notification__item-content');
  }
  get footerItemLink() {
    return this.footerItemContentCO + '//strong//a';
  }
  async hasNotificationLink() {
    return await (await $(this.footerItemLink)).isExisting();
  }
}


