import Component from '../../component.js'
import CoEuiButton from './eui-button.js'
import CoEuiIcon from './eui-icon.js'


export default class CoEuiUploadedFile extends Component {
  constructor(parent) {
    let selector = 'eui-uploaded-file';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components-next/src/lib/components/eui-file-upload/uploaded-file/uploaded-file.component.html
  }
  get fileUploadPreviewContainer() {
    return this.currentPath + '//div[contains(@class,"file-upload__preview")]';
  }
  get fileUploadPreviewImageContainer() {
    return this.fileUploadPreviewContainer + '//div[contains(@class,"file-upload__preview__image")]';
  }
  get fileUploadPreviewImage() {
    return this.fileUploadPreviewImageContainer + '//img';
  }
  async hasPreviewImage() {
    return await (await $(this.fileUploadPreviewImage)).isExisting();
  }
  get fileUploadPreviewImageText() {
    return this.fileUploadPreviewImageContainer + '//i[contains(@class,"fa")]';
  }
  async hasPreviewText() {
    return await (await $(this.fileUploadPreviewImageText)).isExisting();
  }
  get fileUploadPreviewIcon() {
    return this.fileUploadPreviewContainer + '//div[contains(@class,"file-upload__preview__icon")]';
  }
  async hasPreviewIcon() {
    return await (await $(this.fileUploadPreviewIcon)).isExisting();
  }
  get fileUploadPreviewIconText() {
    return this.fileUploadPreviewIcon + '//i[contains(@class,"fa")]';
  }
  get previewFilename() {
    return this.fileUploadPreviewContainer + '//div[contains(@class,"file-upload__preview__filename")]';
  }
  async isFilenameDisplayed() {
    return await (await $(this.previewFilename)).isExisting();
  }
  get previewFilesize() {
    return this.fileUploadPreviewContainer + '//div[contains(@class,"file-upload__preview__filesize")]';
  }
  async isFilesizeDisplayed() {
    return await (await $(this.previewFilesize)).isExisting();
  }
  get previewFiletype() {
    return this.fileUploadPreviewContainer + '//div[contains(@class,"file-upload__preview__filetype")]';
  }
  async isFiletypeDisplayed() {
    return await (await $(this.previewFiletype)).isExisting();
  }
  get previewActions() {
    return this.fileUploadPreviewContainer + '//div[contains(@class,"file-upload__preview__actions")]';
  }
  get previewActionsContainer() {
    return this.previewActions + '//div[contains(@class,"file-upload__preview__actions-container")]';
  }
  get removeFromListActionButtonCO() {
    return new CoEuiButton(this.previewActionsContainer).byAttributeContains('iconClass','eui-icon-times');
  }
}


