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';


export default class CoEuiUserProfileContent extends Component {
    constructor(parent) {
        let selector = 'div[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).byClassContains('eui-user-profile__infos');
    }
    async hasNoSubInfos() {
        return await elementAttributeContains(this.infosCO, '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).byClassContains('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).byClassContains('eui-u-ml-2xs');
    }
    get impersonatedInfosName() {
        return this.impersonatedInfosWelcomeCO + '/following-sibling::div[contains(@class, "eui-user-profile__infos-name")]';
    }
    get impersonatedSubInfos() {
        return this.impersonatedInfosWelcomeCO + '/following-sibling::div[contains(@class, "eui-user-profile__infos-subinfos")]';
    }
    get infosWelcome() {
        return this.infosCO + '//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 avatarShadowCO() {
        return new DivComponent(this.currentPath).byClassContains('eui-user-profile__avatar-shadow');
    }
    get defaultAvatarCO() {
        return new DivComponent(this.avatarShadowCO).byClassContains('eui-u-svg--default-avatar');
    }
    get avatarCO() {
        return new DivComponent(this.currentPath).byClassContains('eui-user-profile__avatar');
    }
    async avatarOnline() {
        return await elementAttributeContains(this.avatarCO.currentPath, 'class', 'eui-user-profile__avatar--online');
    }
    async avatarOffline() {
        return await elementAttributeContains(this.avatarCO.currentPath, 'class', 'eui-user-profile__avatar--offline');
    }
    get avatarUrlCO() {
        return new DivComponent(this.currentPath).addSelectorPredicate('[contains(@class,"eui-user-profile__avatar") and contains(@class,"eui-u-svg")]')
    }
    async hasAvatarUrl() {
        return await (await this.avatarUrlCO.element()).isExisting();
    }
    get avatarImage() {
        return this.avatarUrlCO + '//img';
    }
}

