import { Component, h, Prop } from '@stencil/core';
export class FileIcon {
  constructor() {
    this.defaultIconStyle = 'text-muted';
    this.fileTypeToIconStyleMapping = [
      { fileType: 'pdf', iconStyle: 'file-icon-red-dark' },
      { fileType: 'word', iconStyle: 'file-icon-blue' },
      { fileType: 'powerpoint', iconStyle: 'file-icon-purple' }
    ];
    this.fileTypeToFontawesomeMapping = [
      { fileType: 'pdf', iconName: 'file-pdf' },
      { fileType: 'word', iconName: 'file-word' },
      { fileType: 'powerpoint', iconName: 'file-powerpoint' }
    ];
    this.getFontawesomeStyleFromFileType = (fileType) => {
      const result = this.fileTypeToFontawesomeMapping.find((mapping) => mapping.fileType === fileType);
      return result ? result.iconName : 'file-alt';
    };
  }
  render() {
    const weight = this.isEmpty ? 'fal' : 'fas';
    const colour = this.isEmpty
      ? this.defaultIconStyle
      : this.getIconStyleFromFileType(this.fileType);
    return (h("ap-ben-icon", { iconPrefix: weight, iconId: this.getFontawesomeStyleFromFileType(this.fileType), class: colour }));
  }
  getIconStyleFromFileType(fileType) {
    const result = this.fileTypeToIconStyleMapping.find((mapping) => mapping.fileType === fileType);
    if (result) {
      return result.iconStyle;
    }
    else {
      return this.defaultIconStyle;
    }
  }
  static get is() { return "ap-ben-file-icon"; }
  static get originalStyleUrls() { return {
    "$": ["file-icon.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["file-icon.css"]
  }; }
  static get properties() { return {
    "fileType": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "SupportedDocumentFormat",
        "resolved": "\"pdf\" | \"powerpoint\" | \"word\"",
        "references": {
          "SupportedDocumentFormat": {
            "location": "local"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "file-type",
      "reflect": false
    },
    "isEmpty": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "is-empty",
      "reflect": false
    }
  }; }
}
