import Component from '../component.js'
import { elementAttributeContains } from '../../core/utils.js'
import DivComponent from '../div.js';
import SpanComponent from '../span.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 CoEuiBadge from './eui-badge.js';
import CoEuiAvatarBadge from './eui-avatar-badge.js';
import CoEuiIconSvg from './eui-icon-svg.js';


export default class CoEuiUserProfileContent extends Component {
    constructor(parent) {
        let selector = 'button[contains(@class, "eui-user-profile-content")]';
        super(parent, selector);
        //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/layout/eui-user-profile/user-profile.component.html?at=refs%2Fheads%2Fmaster
    }
    get infosCO() {
        return new DivComponent(this.currentPath).addPredicateClassContains('eui-user-profile__infos');
    }
    async hasNoSubInfos() {
        return await elementAttributeContains(this.infosCO.currentPath, 'class', 'eui-user-profile__infos--no-subinfos');
    }
    get impersonatedInfosWelcomeCO() {
        return new DivComponent(this.currentPath, 'div[contains(@class,"eui-user-profile__infos-welcome")]').byChildSelector('strong');
    }
    async hasImpersonatedUserInfos() {
        return await (await this.impersonatedUserInfosCO.element()).isExisting();
    }
    get impersonatedInfosWelcomeLabelCO() {
        return new SpanComponent(this.impersonatedInfosWelcomeCO).addPredicateClassContains('eui-u-mr-2xs');
    }
    async hasWelcomeLabel() {
        return await (await this.impersonatedInfosWelcomeLabelCO.element()).isExisting();
    }
    get impersonatedUserInfosCO() {
        return new StrongComponent(this.impersonatedInfosWelcomeCO);
    }
    get impersonatedLabelCO() {
        return new SpanComponent(this.impersonatedInfosWelcomeCO).addPredicateClassContains('eui-u-ml-2xs');
    }
    get impersonatedInfosName() {
        return this.impersonatedInfosWelcomeCO.currentPath + '/following-sibling::div[contains(@class, "eui-user-profile__infos-name")]';
    }
    get impersonatedSubInfos() {
        return this.impersonatedInfosWelcomeCO.currentPath + '/following-sibling::div[contains(@class, "eui-user-profile__infos-subinfos")]';
    }
    get infosWelcome() {
        return this.infosCO.currentPath + '//div[contains(@class,"eui-user-profile__infos-welcome")][not(strong)]';
    }
    get infosName() {
        return this.infosWelcome + '/following-sibling::div[contains(@class, "eui-user-profile__infos-name")]';
    }
    get subInfos() {
        return this.infosWelcome + '/following-sibling::div[contains(@class, "eui-user-profile__infos-subinfos")]';
    }
    get avatarCO() {
        return new CoEuiAvatar(this.currentPath);
    }
    get avatarTextCO() {
        return new CoEuiAvatarText(this.avatarCO);
    }
    async hasShadow() {
        return await (await this.avatarCO.element()).isExisting();
    }
    async isShowAvatarInitials() {
        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 avatarBadgeCO() {
        return new CoEuiAvatarBadge(this.avatarCO);
    }
    get badgeCO() {
        return new CoEuiBadge(this.avatarBadgeCO);
    }
    get badgeImageCO() {
        return new CoEuiIconSvg(this.badgeCO);
    }
}

