import CoEuiAlert from '../../../../components/10x/eui/eui-alert.js'
import EuiBasePage from '../eui-base.po.js'

export default class EuiAlertPage extends EuiBasePage {

  constructor() {
      super();
  }

  /**
   * Returns the index-nth CoEuiAlert from the page
   * @param index - index of the component
   * @returns CoEuiAlert
   */
  alertByIndex(index) {
    let alert =  new CoEuiAlert(this.mainContent);
    return alert.byIndex(index);
  }

  /**
   * Returns the CoEuiAlert from the page that contains the text
   * @param text - text to be contained
   * @returns CoEuiAlert
   */
  alertByTextContains(text) {
    let alert = new CoEuiAlert(this.mainContent);
    return alert.byTextContains(text);
  }

  /**
   * Returns the CoEuiAlert from the page that contains the text
   * @param text - text to be contained
   * @returns CoEuiAlert
   */
  alertByTextEqualsAndIndex(text, index, normalize=true) {
    let alert = new CoEuiAlert(this.mainContent);
    return alert.byTextEqualsAndIndex(text, index, normalize);
  }

    /**
   * @param sectionId id of the section into witch to search the component
   * @param index index of the component inside the section
   * @returns CoEuiAlert
   */
   alertFromSectionWithId(sectionId) {
      return new CoEuiAlert(this.sectionById(sectionId));
   }

  /**
   * @param sectionId id of the section into witch to search the component
   * @param index index of the component inside the section
   * @returns CoEuiAlert
   */
  alertFromSectionWithIdByIndex(sectionId, index) {
    let alert = new CoEuiAlert(this.sectionById(sectionId));
    return alert.byIndex(index);
  }
}


