import Component  from '../component.js';
import DivComponent from '../div.js';
import SpanComponent from '../span.js';
import AComponent from '../a.js';

export default class CoEuiDashboardCard extends Component {
  constructor(parent) {
    let selector = 'eui-dashboard-card';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-dashboard-card/eui-dashboard-card.component.html?at=master
  }
  get containerCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-dashboard-card');
  }
  async isHorizontalLayout() {
    return await (await $(this.containerCO.currentPath + '/self::div[contains(@class,"row")]')).isExisting();
  }
  async isClickable() {
    return await (await $(this.containerCO.currentPath + '/self::div[contains(@class,"eui-dashboard-card--clickable")]')).isExisting();
  }
  async isIconCompact() {
    return await (await $(this.containerCO.currentPath + '/self::div[contains(@class,"eui-dashboard-card--icon-compact")]')).isExisting();
  }
  async isIconCompactAndHorizontalLayout() {
    return await (await $(this.containerCO.currentPath + '/self::div[contains(@class,"eui-dashboard-card--horizontal--icon-compac")]')).isExisting();
  }
  get iconContainerCO() {
    return new DivComponent(this.containerCO).addPredicateClassContains('eui-dashboard-card__icon-container');
  }
  async hasIconClass() {
    return await (await this.iconContainerCO.element()).isExisting();
  }
  get iconWrapperCO() {
    return new DivComponent(this.iconContainerCO).addPredicateClassContains('eui-dashboard-card__icon-wrapper');
  }
  get iconWrapperIconCO() {
    return new SpanComponent(this.iconWrapperCO).addPredicateClassContains('eui-dashboard-card__icon-wrapper-icon');
  }
  get imageContainerCO() {
    return new DivComponent(this.containerCO).addPredicateClassContains('eui-dashboard-card__image-container');
  }
  async hasImageUrl() {
    return await (await this.imageContainerCO.element()).isExisting();
  }
  get imageWrapperCO() {
    return new DivComponent(this.imageContainerCO).addPredicateClassContains('eui-dashboard-card__image-wrapper');
  }
  get image() {
    return this.imageWrapperCO.currentPath + '//img';
  }
  get contentWrapperCO() {
    return new DivComponent(this.containerCO).addPredicateClassContains('eui-dashboard-card__content-wrapper');
  }
  get contentWrapperContentCO() {
    return new DivComponent(this.contentWrapperCO).addPredicateClassContains('eui-dashboard-card__content');
  }
  get contentLabelCO() {
    return new DivComponent(this.contentWrapperContentCO).addPredicateClassContains('eui-dashboard-card__content-label');
  }
  get contentSubLabelCO() {
    return new DivComponent(this.contentWrapperContentCO).addPredicateClassContains('eui-dashboard-card__content-sub-label');
  }
  get contentLinkCO() {
    return new DivComponent(this.contentWrapperContentCO).addPredicateClassContains('eui-dashboard-card__content-link');
  }
  get externalUrl() {
    return new AComponent(this.contentLinkCO).addSelectorPredicate('[@href]');
  }
  async hasExternalUrl() {
    return await (await $(this.externalUrl)).isExisting();
  }
  get url() {
    return new AComponent(this.contentLinkCO).addSelectorPredicate('[not(@href)]');
  }
  async hasUrl() {
    return await (await $(this.url)).isExisting();
  }
}


