import { Component, h, Host, Prop } from '@stencil/core';
import { AttachmentSourceType } from '../attachment';
export class DvnFieldDisplayCellAttachment {
  render() {
    const { field } = this;
    if (field.sourceType === AttachmentSourceType.RawUrl) {
      const src = this.value;
      return (h(Host, null,
        h("dvn-image", { leaned: true, bordered: true, src: src, shape: field.shape })));
    }
    let attachments = [];
    if (field.sourceType === AttachmentSourceType.AttachmentObject) {
      attachments = [this.value];
    }
    else if (field.sourceType === AttachmentSourceType.AttachmentObjects) {
      attachments = this.value;
    }
    return (h(Host, null, attachments.map(attachment => (h("dvn-image", { leaned: true, bordered: true, src: attachment.url })))));
  }
  static get is() { return "dvn-field-display-cell-attachment"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["dvn-field-display-cell-attachment.css"]
  }; }
  static get styleUrls() { return {
    "$": ["dvn-field-display-cell-attachment.css"]
  }; }
  static get properties() { return {
    "value": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "AttachmentValue",
        "resolved": "AttachmentObject | AttachmentObject[] | string",
        "references": {
          "AttachmentValue": {
            "location": "import",
            "path": "../attachment"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "value",
      "reflect": false
    },
    "field": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "AttachmentField",
        "resolved": "AttachmentField",
        "references": {
          "AttachmentField": {
            "location": "import",
            "path": "../attachment"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
}
