import Component from '../../component.js'
import MatCard from '../../material/mat-card.js'
import CoEuiCardHeader from './eui-card-header.js'
import CoEuiCardMedia from './eui-card-media.js'
import CoEuiCardContent from './eui-card-content.js'
import CoEuiCardFooter from './eui-card-footer.js'

CoEuiCardMedia
import { elementAttributeContains } from '../../../core/utils.js'

export default class CoEuiCard extends Component {
  constructor(parent) {
    let selector = 'eui-card';
    super(parent, selector);
    // https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components-next/src/lib/components/eui-card/eui-card.component.html
  }
  get matCardCO() {
    return new MatCard(this.currentPath);
  }
  get container() {
    let path = '/self::mat-card[contains(@class,"eui-card-container")]';
    return this.matCardCO.currentPath + path;
  }
  get header() {
    let path = '//eui-card-header';
    return this.container + path;
  }
  async hasHeader() {
    return await (await $(this.header)).isExisting();
  }
  get media() {
    let path = '//eui-card-media';
    return this.container + path;
  }
  async hasMedia() {
    return await (await $(this.media)).isExisting();
  }
  get content() {
    let path = '//eui-card-content';
    return this.container + path;
  }
  async hasContent() {
    return await (await $(this.content)).isExisting();
  }
  get footer() {
    let path = '//eui-card-footer';
    return this.container + path;
  }
  async hasFooter() {
    return await (await $(this.footer)).isExisting();
  }
  async isCollapsible() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--collapsible');
  }
  async isCollapsed() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--collapsed');
  }
  async isSelected() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--selected');
  }
  async isUrgent() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--urgent');
  }
  async isNoShadow() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--no-shadow');
  }
  async isNoContentPadding() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--no-content-padding');
  }
  async isHoverable() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--hoverable');
  }
  async isFlat() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--flat');
  }
  async isEditable() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-card--highlighted');
  }
  get euiCardHeaderCO() {
    return new CoEuiCardHeader(this.currentPath);
  }
  get euiCardMediaCO() {
    return new CoEuiCardMedia(this.currentPath);
  }
  get euiCardContentCO() {
    return new CoEuiCardContent(this.currentPath);
  }
  get euiCardFooterCO() {
    return new CoEuiCardFooter(this.currentPath);
  }
}


