import Component  from '../component.js';
import LiComponent from '../li.js';
import PComponent from '../p.js';
import DivComponent from '../div.js';
import SpanComponent from '../span.js';

export default class CoEuiDiscussionThreadItem extends Component {
  constructor(parent) {
    let selector = 'eui-discussion-thread-item';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-discussion-thread/eui-discussion-thread-item.component.html?at=master
  }
  get listItemCO() {
    return LiComponent(this.currentPath).addPredicateClassContains('eui-discussion-thread__item');
  }
  async isOdd() {
    return await(await $(this.listItemCO.currentPath + '/self::li[contains(@class, "eui-discussion-thread-inverted")]')).isExisting();
  }
  get badgeCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-discussion-thread-badge');
  }
  get iconCO() {
     return new SpanComponent(this.badgeCO);
  }
  async hasInfoIcon() {
    return await(await $(this.iconCO.currentPath + '/self::span[contains(@iconclass, "eui-icon-info")]')).isExisting();
  }
  async hasSuccessIcon() {
    return await(await $(this.iconCO.currentPath + '/self::span[contains(@iconclass, "eui-icon-check")]')).isExisting();
  }
  async hasWarningIcon() {
    return await(await $(this.iconCO.currentPath + '/self::span[contains(@iconclass, "eui-icon-exclamation")]')).isExisting();
  }
  async hasDangerIcon() {
    return await(await $(this.iconCO.currentPath + '/self::span[contains(@iconclass, "eui-icon-times")]')).isExisting();
  }
  async hasMoreIcon() {
    return await(await $(this.iconCO.currentPath + '/self::span[contains(@iconclass, "eui-icon-more-horizontal")]')).isExisting();
  }
  get panelCO() {
    return new DivComponent(this.listItemCO).addPredicateClassContains('eui-discussion-thread-panel');
  }
  get headerCO() {
    return new DivComponent(this.panelCO).addPredicateClassContains('eui-discussion-thread-header');
  }
  get headingCO() {
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-discussion-thread-heading');
  }
  get titleCO() {
    return new DivComponent(this.headingCO).addPredicateClassContains('eui-discussion-thread-title');
  }
  get timeCO() {
    return new DivComponent(this.headingCO).addPredicateClassContains('eui-discussion-thread-time');
  }
  get timeSpanCO() {
    return new SpanComponent(this.timeCO).addPredicateClassContains('ion-android-time');
  }
  get subheadingCO() {
    return new DivComponent(this.headerCO).addPredicateClassContains('eui-discussion-thread-subheading');
  }
  get bodyCO() {
    return new DivComponent(this.panelCO).addPredicateClassContains('eui-discussion-thread-body');
  }
  get wordBreakCO() {
    return PComponent(this.bodyCO).addPredicateClassContains('eui-discussion-thread-body__word-break');
  }
}


