import Component from '../component.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiIconState extends Component {
  constructor(parent) {
    let selector = 'eui-icon-state';
    super(parent, selector);
    // https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-icon-state/eui-icon-state.component.html
  }
  get buttonIconCO() {
    return new CoEuiIconSvg(this.currentPath)
  }
  async iconSeverity() {
    let cl = await (await this.buttonIconCO.element()).getAttribute('icon');
    if (cl.includes('checkmark-circle:outline')) {
      return 'checkmark';
    } else if (await cl.includes('warning:outline')) {
      return 'warning';
    } else if (await cl.includes('alert-circle:outline')) {
      return 'danger';
    } else if (await cl.includes('help-circle:outline')) {
      return 'help';
    } else if (await cl.includes('information-circle:outline')) {
      return 'information';
    }
  }
}
