import Component  from '../component.js'
import { elementAttributeContains } from '../../core/utils.js'

export default class CoEuiAlert extends Component {
    constructor(parent) {
      let selector = '*[self::eui-alert or self::div[euiAlert]]';
      super(parent, selector);
      // https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-alert/eui-alert.component.html?at=support/13.x
    }
    get contentContainer() {
      return this.currentPath + '//div[contains(@class,"eui-alert__content-wrapper")]';
    }
    get roleAlert() {
      return this.contentContainer + '//div[contains(@role,"alert")]';
    }
    get alertClose() {
      return this.contentContainer + '//a[contains(@role,"button")]';
    }
    async isCloseable() {
      return await (await $(this.alertClose)).isExisting();
    }
    async isMuted() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-alert--muted');
    }
    async isHidden() {
      return await elementAttributeContains(this.currentPath, 'class', 'eui-alert--hidden');
    }
}