import AComponent from '../a.js';
import Component  from '../component.js';
import DivComponent from '../div.js';
import SpanComponent from '../span.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiNotificationItem extends Component {
  constructor(parent) {
    let selector = 'eui-notification-item';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/layout/eui-notifications/eui-notification-item.component.html
  }
  get contentCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-notification-item-content')
  }
  get contentTopCO() {
    return new DivComponent(this.contentCO).addPredicateClassContains('eui-notification-item-content-top');
  }
  get contentTopDateCO() {
    return new DivComponent(this.contentTopCO).addPredicateClassContains('eui-notification-item-content-top__date');
  }
  async hasDate() {
    return await (await this.contentTopDateCO.element()).isExisting();
  }
  get contentTopDateIconCO() {
    return new SpanComponent(this.contentTopDateCO).addPredicateClassContains('eui-notification-item-content-top__date');
  }
  get contentTopDateIconBellCO() {
    return new SpanComponent(this.contentTopDateIconCO).addPredicateClassContains('eui-icon eui-icon-bell');
  }
  get contentTopDateIconDotCO() {
    return new SpanComponent(this.contentTopDateIconCO).addPredicateClassContains('eui-notification-item-content-top__date-dot')
  }
  async hasNew() {
    return await (await this.contentTopDateIconDotCO.element()).isExisting();
  }
  get contentTopDateValueCO() {
    return new SpanComponent(this.contentTopDateCO).addPredicateClassContains('eui-u-color-grey-dark');
  }
  get contentTopImportantCO() {
    return new DivComponent(this.contentTopCO).addPredicateClassContains('eui-u-color-grey-dark');
  }
  get contentTopIconExclamationCO() {
    return new CoEuiIconSvg(this.contentTopImportantCO);
  }
  async hasImportant() {
    return await (await this.contentTopImportantCO.element()).isExisting();
  }
  get contentMiddleCO() {
    return new SpanComponent(this.contentCO).addPredicateClassContains('eui-notification-item-content-middle');
  }
  get contentMiddleUrlCO() {
    return new AComponent(this.contentMiddleCO).addSelectorPredicate('[@href][not(@target)]');
  }
  async hasUrl() {
    return await (await this.contentMiddleUrlCO.element()).isExisting();
  }
  get contentMiddleLabelCO() {
    return new DivComponent(this.contentMiddleUrlCO).addPredicateClassContains('eui-notification-item-content-middle__label');
  }
  get contentMiddleSubLabelCO() {
    return new DivComponent(this.contentMiddleUrlCO).addPredicateClassContains('eui-notification-item-content-middle__sub-label');
  }
  async hasSubLabel() {
    return await (await this.contentMiddleSubLabelCO.element()).isExisting();
  }
  get contentMiddleExternalUrlCO() {
    return new AComponent(this.contentMiddleCO).addSelectorPredicate('[@target]');
  }
  async hasExternalUrl() {
    return await (await this.contentMiddleExternalUrlCO.element()).isExisting();
  }
  get contentMiddleExternalLabelCO() {
    return new DivComponent(this.contentMiddleExternalUrlCO).addPredicateClassContains('eui-notification-item-content-middle__label');
  }
  get contentMiddleExternalSubLabelCO() {
    return new DivComponent(this.contentMiddleExternalUrlCO).addPredicateClassContains('eui-notification-item-content-middle__sub-label');
  }
  async hasExternalSubLabel() {
    return await (await this.contentMiddleExternalSubLabelCO.element()).isExisting();
  }
  get contentMiddleLabelNoUrl() {
    let path = '//div[contains(@class,"eui-notification-item-content-middle__label")][not(ancestor::a)]';
    return this.contentMiddleCO + path;
  }
  get contentMiddleSubLabelNoUrl() {
    let path = '//div[contains(@class,"eui-notification-item-content-middle__sub-label")][not(ancestor::a)]';
    return this.contentMiddleCO + path;
  }
  async hasSubLabelNoUrl() {
    return await (await $(this.contentMiddleSubLabelNoUrl)).isExisting();
  }
  get contentBottomCO() {
    return new DivComponent(this.contentCO).addPredicateClassContains('eui-notification-item-content-bottom');
  }
  get contentBottomLinkCO() {
    return new AComponent(this.contentBottomCO);
  }
  async isShowMarkAsRead() {
    return await (await this.contentBottomLinkCO.element()).isExisting();
  }
}


