import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoUxTimelineItem extends Component {
    constructor(parent) {
      let selector = 'ux-timeline-item';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-timeline/ux-timeline-item.component.ts
    }
    get dataE2E() {
      const path = '//li[@data-e2e="ux-timeline-item"]';
      return this.currentPath + path;
    }
    async isGroup() {
      return await elementAttributeContains(this.dataE2E, 'class', 'ux-timeline-item--more');
    }
    get leftContent() {
      let path = '//div[contains(@class,"ux-timeline-item__left-content")]';
      return this.dataE2E + path;
    }
    async isLeftAligned(){
      return !(await (await $(this.leftContent)).isExisting());
    }
    get date() {
      let path = '//div[contains(@class,"ux-timeline-item__date")]';
      return this.leftContent + path;
    }
    async hasDate(){
      return await (await $(this.date)).isExisting();
    }
    get time() {
      let path = '//div[contains(@class,"ux-timeline-time")]';
      return this.leftContent + path;
    }
    async hasTime(){
      return await (await $(this.time)).isExisting();
    }
    get icon() {
      let path = '//span[contains(@class,"ux-timeline-item__icon")]';
      return this.dataE2E + path;
    }
    get content() {
      let path = '//div[contains(@class,"ux-timeline-item__content")]';
      return this.dataE2E + path;
    }
    get customContent() {
      let path = '//div';
      return this.content + path;
    }
    get title() {
      let path = '//div[contains(@class,"ux-timeline-item__title")]';
      return this.content + path;
    }
    async hasTitle() {
      return await (await $(this.title)).isExisting();
    }
    get subtitle() {
      let path = '//div[contains(@class,"ux-timeline-item__subtitle")]';
      return this.content + path;
    }
    get contentDate() {
      let path = '//div[contains(@class,"ux-timeline-item__date")]';
      return this.content + path;
    }
    async isLeftAlignedDate(){
      return await (await $(this.contentDate)).isExisting();
    }
    get contentTime() {
      let path = '//div[contains(@class,"ux-timeline-item__time")]';
      return this.content + path;
    }
    async isLeftAlignedTime(){
      return await (await $(this.contentTime)).isExisting();
    }
}


