import Component from '../component.js';
import DivComponent from '../div.js';
import AComponent from '../a.js';
import CoEuiButton from './eui-button.js';
import StrongComponent from '../strong.js';
import CoEuiAvatar from './eui-avatar.js';
import CoEuiAvatarText from './eui-avatar-text.js';
import CoEuiAvatarImage from './eui-avatar-image.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiUserProfileCard extends Component {
  constructor(parent) {
    let selector = 'eui-user-profile-card';
    super(parent, selector);
    // https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/layout/eui-user-profile/user-profile-card/user-profile-card.component.html
  }

  get mainWrapperDivCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-user-profile-card__main-wrapper');
  }
  get avatarWrapperDivCO() {
    return new DivComponent(this.mainWrapperDivCO).addPredicateClassContains('eui-user-profile-card__avatar-wrapper');
  }
  get avatarCO() {
    return new CoEuiAvatar(this.avatarWrapperDivCO);
  }
  get avatarTextCO() {
    return new CoEuiAvatarText(this.avatarCO);
  }
  async hasAvatarInitials() {
    return await (await this.avatarTextCO.element()).isExisting();
  }
  get avatarNoUrlCO() {
    return new CoEuiAvatarImage(this.avatarCO).addSelectorPredicate('[not(@imageUrl)]');
  }
  get avatarUrlCO() {
    return new CoEuiAvatarImage(this.avatarCO).addSelectorPredicate('[@imageUrl]');
  }
  async hasAvatarUrl() {
    return await (await this.avatarUrlCO.element()).isExisting();
  }
  get userInfosDivCO() {
    return new DivComponent(this.mainWrapperDivCO).addPredicateClassContains('eui-user-profile-card__userInfos');
  }
  get fullNameDivCO() {
    return new DivComponent(this.userInfosDivCO).addPredicateClassContains('eui-u-font-xl');
  }
  get functionDivCO() {
    return new DivComponent(this.userInfosDivCO).addPredicateClassContains('eui-user-profile-card__userInfos-item').addSelectorPredicate('[1]');
  }
  get organisationDivCO() {
    return new DivComponent(this.userInfosDivCO).addPredicateClassContains('eui-user-profile-card__userInfos-item').addSelectorPredicate('[2]');
  }
  get mainWrapperRightContentDivCO() {
    return new DivComponent(this.mainWrapperDivCO).addPredicateClassContains('eui-user-profile-card__main-wrapper-right-content');
  }
  get closeLinkCO() {
    return new AComponent(this.mainWrapperRightContentDivCO).addPredicateClassContains('eui-u-text-link');
  }
  get userDetailsButtonCO() {
    return new CoEuiButton(this.mainWrapperRightContentDivCO).addPredicateClassContains('eui-u-ml-auto');
  }
  get imageInfoCO() {
    return new CoEuiIconSvg(this.userDetailsButtonCO);
  }
  get impersonateInfosDivCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-user-profile-card__impersonateInfos');
  }
  get impersonateNameDivCO() {
    return new DivComponent(this.impersonateInfosDivCO).addSelectorPredicate('[1]');
  }
  get impersonateLabelDivCO() {
    return new DivComponent(this.impersonateInfosDivCO).addPredicateClassContains('eui-u-mt-2xs').addSelectorPredicate('[1]');
  }
  get impersonateInfosStateDivCO() {
    return new DivComponent(this.impersonateInfosDivCO).addPredicateClassContains('eui-u-mt-2xs').addSelectorPredicate('[2]');
  }
  get impersonateInfosStateStrongCO() {
    return new StrongComponent(this.impersonateInfosDivCO);
  }
}
