import{LitElement as o,html as t,css as n}from"lit";import{iconRemixAlertFill as a}from"./assets/cc-remix.icons.js";import{getAssetUrl as s}from"./lib/assets-url.js";import{ccAddonEncryptionAtRestOption as i}from"./templates/cc-addon-encryption-at-rest-option/cc-addon-encryption-at-rest-option.js";import{i18n as c}from"./translation.js";import"./cc-addon-option-form.js";const e=s("/logos/elasticsearch-kibana.svg"),r=s("/logos/elasticsearch-apm.svg");class l extends o{static get properties(){return{options:{type:Array}}}constructor(){super(),this.options=[]}_getElasticsearchOptionData(o){switch(o){case"apm":return{title:"APM",warning:c("cc-addon-elasticsearch-options.warning.apm"),details:c("cc-addon-elasticsearch-options.details.apm"),logo:r};case"kibana":return{title:"Kibana",warning:c("cc-addon-elasticsearch-options.warning.kibana"),details:c("cc-addon-elasticsearch-options.details.kibana"),logo:e}}}_getElasticAddonOption(o){const{title:n,warning:s,details:i,logo:e}=this._getElasticsearchOptionData(o.name);return{title:n,logo:e,description:t`
      <div class="option-details">${i}</div>
      <div class="option-warning">
        <cc-icon
          .icon="${a}"
          a11y-name="${c("cc-addon-elasticsearch-options.error.icon-a11y-name")}"
          class="icon-warning"
        ></cc-icon>
        <div>
          <p>${s}</p>
          <p>
            <span class="options-warning">
              ${c("cc-addon-elasticsearch-options.warning.flavor",o.flavor)}
            </span>
            ${"monthlyCost"in o.flavor&&null!=o.flavor.monthlyCost?t`
                  <span class="options-warning">
                    ${c("cc-addon-elasticsearch-options.warning.monthly-cost",o.flavor.monthlyCost)}
                  </span>
                `:""}
          </p>
        </div>
      </div>
    `,enabled:o.enabled,name:o.name}}_getFormOptions(){return this.options.map((o=>{switch(o.name){case"apm":case"kibana":return this._getElasticAddonOption(o);case"encryption":return i(o);default:return null}})).filter((o=>null!=o))}render(){const o=this._getFormOptions(),n=c("cc-addon-elasticsearch-options.title"),a=this.options.some((o=>"flavor"in o&&"monthlyCost"in o.flavor));return t`
      <cc-addon-option-form heading="${n}" .options=${o}>
        <div slot="description">
          ${c("cc-addon-elasticsearch-options.description")}
          ${a?c("cc-addon-elasticsearch-options.additional-cost"):""}
        </div>
      </cc-addon-option-form>
    `}static get styles(){return[n`
        :host {
          display: block;
        }
      `]}}window.customElements.define("cc-addon-elasticsearch-options",l);export{l as CcAddonElasticsearchOptions};
//# sourceMappingURL=cc-addon-elasticsearch-options.js.map
