import { Component, h, Host, Prop, Event, State } from '@stencil/core';
import map from 'lodash.map';
export class DownloadMethod {
  constructor() {
    /**
     * decides when to enable the reset button
     */
    this.showReset = false;
  }
  render() {
    return (h(Host, null, map(this.services, (service) => {
      var _a;
      return (h("div", { class: "d-flex" },
        h("input", { class: "mt-2 mr-2", type: "radio", name: service.serviceAgent, id: service.serviceAgent, value: service.serviceAgent, checked: ((_a = this.selectedService) === null || _a === void 0 ? void 0 : _a.serviceAgent) == service.serviceAgent, onChange: () => this.serviceChange.emit(service) }),
        h("label", { htmlFor: service.serviceAgent },
          h("div", { class: "d-flex align-items-center" },
            h("span", { innerHTML: service.agentInfo.serviceLabel }),
            service.agentInfo.about && (h("span", { class: "ml-2" },
              h("a", { href: service.agentInfo.about.link, title: `Learn more about ${service.agentInfo.about.label}`, target: "_blank" },
                h("bs-icon", { icon: "fab fa-question-circle" }))))),
          service.agentInfo.serviceDescription && (h("div", null,
            h("em", { innerHTML: service.agentInfo.serviceDescription }))))));
    })));
  }
  static get is() { return "download-method"; }
  static get properties() { return {
    "services": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "DatasetService[]",
        "resolved": "DatasetService[]",
        "references": {
          "DatasetService": {
            "location": "import",
            "path": "../../../shared/types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "an array of dataset services for the user to choose where to download from"
      }
    },
    "selectedService": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "DatasetService",
        "resolved": "{ agentConfig: AgentConfig; serviceAgent: string; capabilities: string[]; osdd: string; requiredParams: string[]; spatialServices: string[]; spatialModes: string[]; formats: [DataAccessFormat]; agentInfo: AgentInfo; }",
        "references": {
          "DatasetService": {
            "location": "import",
            "path": "../../../shared/types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "the service to select, a default will be set if one isn't passed in"
      }
    }
  }; }
  static get states() { return {
    "showReset": {}
  }; }
  static get events() { return [{
      "method": "serviceChange",
      "name": "serviceChange",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": "an event that is fired when the user changes the selected service"
      },
      "complexType": {
        "original": "DatasetService",
        "resolved": "{ agentConfig: AgentConfig; serviceAgent: string; capabilities: string[]; osdd: string; requiredParams: string[]; spatialServices: string[]; spatialModes: string[]; formats: [DataAccessFormat]; agentInfo: AgentInfo; }",
        "references": {
          "DatasetService": {
            "location": "import",
            "path": "../../../shared/types"
          }
        }
      }
    }]; }
}
