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'
import AComponent from '../a.js'
import CoEuiIconButton from './eui-icon-button.js'
import StrongComponent from '../strong.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 CoEuiIconButton(this.currentPath).addPredicateClassContains('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 headerButtonCO() {
    return new CoEuiButton(this.headerActionsCO);
  }
  get headerButtonIconCO() {
    return new CoEuiIconSvg(this.headerButtonCO);
  }
  async isShowMarkAllAsReadButton() {
    return await elementAttributeContains(this.headerButtonIconCO.currentPath, 'icon', 'checkmark-done');
  }
  async isShowSettingsButton() {
    return await elementAttributeContains(this.headerButtonIconCO.currentPath, 'icon', 'settings');
  }
  async isShowRefreshButton() {
    return await elementAttributeContains(this.headerButtonIconCO.currentPath, 'icon', 'refresh');
  }
  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 footerLinkCO() {
    return new AComponent(this.euiOverlayCO.euiOverlayFooterCO).byChildSelector('strong');
  }
  get footerLabelCO() {
    return new StrongComponent(this.footerLinkCO);
  }
  get footerItemContentCO() {
    return new DivComponent(this.euiOverlayCO.euiOverlayFooterCO).addPredicateClassContains('ux-notification__item-content');
  }
  get footerItemLinkCO() {
    return new AComponent(this.footerItemContentCO);
  }
  async hasNotificationLink() {
    return await (await this.footerItemLinkCO.element()).isExisting();
  }
}


