import Component from '../component.js';
import DivComponent from '../div.js';
import ImgComponent from '../img.js';
import AComponent from '../a.js';
import CoEuiButton from '../16x/eui-button.js';
import StrongComponent from '../strong.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 avatarInitialsDivCO() {
    return new DivComponent(this.avatarWrapperDivCO).addPredicateClassContains('eui-user-profile-card__avatar-initials');
  }
  async hasAvatarInitials() {
    return await (await this.avatarInitialsDivCO.element()).isExisting();
  }
  get defaultAvatarDivCO() {
    return new DivComponent(this.avatarWrapperDivCO).addPredicateClassContains('eui-user-profile-card__avatar--');
  }
  get defaultAvatarDivCO() {
    return new DivComponent(this.avatarWrapperDivCO).addPredicateClassContains('eui-user-profile-card__avatar--');
  }
  async isDefaultAvatarOnline() {
    return await (await this.defaultAvatarDivCO.byClassContains('eui-user-profile-card__avatar--online').element()).isExisting();
  }
  get defaultAvatarImgCO() {
    return new ImgComponent(this.defaultAvatarDivCO).addPredicateAttributeContains('alt', 'avatar');
  }
  get userInfosDivCO() {
    return new DivComponent(this.mainWrapperDivCO).addPredicateClassContains('eui-user-profile-card__userInfos');
  }
  get fullNameDivCO() {
    return new DivComponent(this.userInfosDivCO).addPredicateClassContains('eui-u-font-size-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-text-link');
  }
  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).addSelectorPredicate('[1]');
  }
}
