import Component from '../../component.js'
import CoUxAicon from './ux-a-icon.js'
import InputComponent from '../../input.js'
import CoUxBadge from './ux-badge.js'
import CoUxDisableContent from './ux-disable-content.js'
import CoUxDropdownButton from './ux-dropdown-button.js'

export default class CoUxCard extends Component {

    constructor(parent) {
      let selector = 'ux-card';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-card/ux-card.component.html?at=support/10.x
    }
    get dataE2E() {
      let path = '//div[@data-e2e="ux-card"]';
      return this.currentPath + path;
    }
    get header() {
      let path = '//div[@class = "ux-card__header"]';
      return this.dataE2E + path;
    }
    get statusIndicator() {
      let path = '//span[contains(@class, "ux-card__header-status-indicator")]';
      return this.dataE2E + path;
    }
    async hasStatusIndicator() {
      return await (await $(this.statusIndicator)).isExisting();
    }
    get statusIndicatorIcon() {
      let path = '//span[contains(@class, "ux-card__header-status-indicator-icon")]';
      return this.statusIndicator + path;
    }
    get headerLeftContent() {
      let path = '//div[contains(@class, "ux-card__header-left-content")]';
      return this.header + path;
    }
    get headerLeftContentSelect() {
      let path = '//div[contains(@class, "ux-card__header-left-content-select")]';
      return this.headerLeftContent + path;
    }
    async isSelectable() {
      return await (await $(this.headerLeftContentSelect)).isExisting();
    }
    get headerLeftContentSelectCheckboxInputCo() {
      return new InputComponent(this.headerLeftContentSelect);
    }
    async isSelected() {
      return await this.headerLeftContentSelectCheckboxInputCo.isSelected();
    }
    get headerLeftContentFavouriteIconCo() {
      return new CoUxAicon(this.headerLeftContent).byAttributeContains('iconClass', 'eui-icon-star');
    }
    async isFavouritable() {
      return await ( await( await (this.headerLeftContentFavouriteIconCo.element()))).isExisting();
    }
    async isFavourite() {
      return await (await $(this.headerLeftContentFavouriteIconCo.byAttributeContains('class', 'eui-u-color-accent-dark').currentPath)).isExisting();
    }
    get headerLeftContentUrgentIconCo() {
      return new CoUxAicon(this.headerLeftContent).byAttributeContains('iconClass', 'eui-icon-flag');
    }
    async isUrgentable() {
      return await( await (await this.headerLeftContentUrgentIconCo.element())).isExisting()
    }
    async isUrgent() {
      return await(await (await this.headerLeftContentUrgentIconCo.byAttributeContains('class', 'eui-u-color-accent-dark').element())).isExisting();
    }
    get headerTitle() {
      let path = '//div[@class = "ux-card__header-title"]';
      return this.header + path;
    }
    get headerTitleMain() {
      let path = '//div[contains(@class, "ux-card__header-title-main")]';
      return this.headerTitle + path;
    }
    get headerTitleSub() {
      let path = '//div[contains(@class, "ux-card__header-title-sub")]';
      return this.headerTitle + path;
    }
    get headerRightContent() {
      let path = '//div[contains(@class, "ux-card__header-right-content")]';
      return this.header + path;
    }
    get headerRightCustomContent() {
      let path = '//div[contains(@class, "ux-card__header-right-content__custom-content")]';
      return this.headerRightContent + path;
    }
    get headerRightContentStatus() {
      let path = '//div[contains(@class, "ux-card__header-right-content")]';
      return this.header + path;
    }
    get headerRightContentStatusBadgeCo (){
      return new CoUxBadge(this.headerRightContentStatus);
    }
    get headerRightContentStatusLabel() {
      let path = '/div[contains(@class, "eui-u-font-size-s")]';
      return this.headerRightContentStatus + path;
    }
    get headerRightContentLocalMenu() {
      let path = '//div[contains(@class, "ux-card__header-right-content")]';
      return this.header + path;
    }
    get headerRightContentLocalMenuDisableContentCo () {
      return new CoUxDisableContent(this.headerRightContentLocalMenu);
    }
    async areActionsDisabled() {
      return await this.headerRightContentLocalMenuDisableContentCo.isDisabled();
    }
    get headerRightContentLocalMenuDropdownButtonCo () {
      return new CoUxDropdownButton(this.headerRightContentLocalMenuDisableContentCo.disableContentDataDiv);
    }
    get body() {
      let path = '//div[contains(@class,"ux-card__body")]';
      return this.dataE2E + path;
    }
    async isCardBodyHidden() {
      return !(await(await (await $(this.body))).isExisting());
    }
    get expandToggle() {
      let path = '//span[contains(@class,"ux-card__expand-trigger-toggle")]';
      return this.dataE2E + path;
    }
    get expandToggleIcon() {
      let path = '//span[contains(@class,"eui-icon")]';
      return this.expandToggle + path;
    }
    async isCollapsible() {
      return await (await $(this.expandToggle)).isExisting();
    }
    async isCollapsed() {
      return await (await $(this.expandToggleIcon + '/self::*[contains(@class, "eui-icon-angle-down")]')).isExisting();
    }
}


