import Component from '../../component.js'
import CoUxCarouselItem from './ux-carousel-item.js'
import CoUxCarouselItemsSummaryIndicators from './ux-carousel-items-summary-indicators.js'
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoUxCarouselItems extends Component {
    constructor(parent) {
      let selector = 'ux-carousel-items';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-carousel-item/ux-carousel-items.component.html?at=support/10.x
    }
    get dataE2E() {
      let path = '//div[contains(@data-e2e,"ux-carousel-items")]';
      return this.currentPath + path;
    }
    get content() {
      let path = '//div[contains(@class,"ux-carousel-items__content")]';
      return this.dataE2E + path;
    }
    get arrowLeft() {
      let path = '//span[contains(@class,"eui-icon-caret-left") and contains(@class,"ux-carousel-items__arrow")]';
      return this.content + path;
    }
    async isFirstItemActive() {
      return await elementAttributeContains(this.arrowLeft, 'class', 'ux-carousel-items__arrow--inactive');
    }
    get animation() {
      let path = '//div[contains(@class,"col")]';
      return this.content + path;
    }
    get animationUl() {
      let path = '//ul[contains(@aria-live,"polite")]';
      return this.animation + path;
    }
    get arrowRigth() {
      let path = '//span[contains(@class,"eui-icon-caret-right") and contains(@class,"ux-carousel-items__arrow")]';
      return this.content + path;
    }
    async isLastItemActive() {
      return await elementAttributeContains(this.arrowRigth, 'class', 'ux-carousel-items__arrow--inactive');
    }
    get summaryIndicators() {
      let path = '//div[contains(@class,"ux-carousel-items__summary-indicators")]';
      return this.dataE2E + path;
    }
    async isShowSummaryIndicators() {
      return await (await $(this.summaryIndicators)).isExisting();
    }
    get summaryIndicatorsItemCO() {
      return new CoUxCarouselItemsSummaryIndicators(this.summaryIndicators);
    }
    get carouselItemCO() {
      return new CoUxCarouselItem(this.animation);
     }
}


