import Component from '../../component.js'
import { elementAttributeContains } from '../../../core/utils.js';
import CoUxAlabel from './ux-a-label.js';
import CoUxAtag from './ux-a-tag.js';

export default class CoUxListItem extends Component {
    constructor(parent) {
      let selector = 'ux-list-item';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-list-item/ux-list-item.component.html
    }
    get listItemDataDiv() {
      const path = '//div[@data-e2e="ux-list-item"]';
      return this.currentPath + path;
    }
    get listItem() {
      const path = '//div[contains(@class,"ux-list-item")]';
      return this.listItemDataDiv + path;
    }
    get listLabel() {
      return new CoUxAlabel(this.listItem);
    }
    get rightContent() {
      const path = '//div[contains(@class,"ux-list-item__right-content")]';
      return this.listItemDataDiv + path;
    }
    get rightContentTag() {
      return new CoUxAtag(this.rightContent);
    }
    async isSmall(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--small');
    }
    async isLarge(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--large');
    }
    async isHovered(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--hovered');
    }
    async isHoverable(){
      return !(await elementAttributeContains(this.listItem, 'class', 'ux-list-item--not-hoverable'));
    }
    async hasBorder(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--bordered');
    }
    async isCollapsed(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--collapsed');
    }
    async isActive(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--active');
    }
    async hasSeperator(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--seperator');
    }
    async isDisabled(){
      return await elementAttributeContains(this.listItem, 'class', 'ux-list-item--disabled');
    }
    async typeClass() {
      return await (await $(this.currentPath)).getAttribute('typeclass');
    }
    async iconClass() {
      return await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('iconClass');
    }
    async hasMarker(){
      return  await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('hasMarker');
    }
    async markerTypeClass() {
      return await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('markerTypeClass');
    }
    async label() {
      return await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('label');
    }
    async subLabel() {
      return await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('subLabel');
    }
    async isIconRounded(){
      return await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('isIconRounded');
    }
    async iconTypeClass(){
      return await (await $(new CoUxAlabel(this.listLabel).currentPath)).getAttribute('iconTypeClass');
    }
    async tagTypeClass() {
      return await (await $(new CoUxAtag(this.rightContent).currentPath)).getAttribute('typeClass');
    }
    async tagLabel() {
      return await (await $(new CoUxAtag(this.rightContent).currentPath)).getAttribute('label');
    }
    async tagCount() {
      return await (await $(new CoUxAtag(this.rightContent).currentPath)).getAttribute('subLabel');
    }
    async isTagRounded(){
      return await elementAttributeContains(new CoUxAtag(this.rightContent).tagDataDiv, 'class', 'ux-a-tag--rounded');
    }
}


