{{!
  Copyright IBM Corp. 2016, 2025
  SPDX-License-Identifier: BUSL-1.1
}}

{{#each @displayFields as |field|}}
  {{#let (get @model field) as |value|}}
    {{! only render if there's a value, unless it's the commonName or privateKey/Type }}
    {{#if (or value (includes field (array "common_name" "private_key" "private_key_type")))}}
      <InfoTableRow @label={{@label field}} @value={{value}} @addCopyButton={{includes field (array "issuer_id" "key_id")}}>
        {{#if (and (includes field (array "ca_chain" "certificate")) value)}}
          <CertificateCard @data={{value}} />
        {{else if (includes field (array "issuer_id" "key_id"))}}
          <LinkTo @route={{if (eq field "issuer_id") "issuers.issuer.details" "keys.key.details"}} @model={{value}}>
            {{value}}
          </LinkTo>
        {{else if (includes (array "private_key" "private_key_type"))}}
          {{#if value}}
            {{value}}
          {{else}}
            <Hds::Badge @text="internal" />
          {{/if}}
        {{else}}
          {{value}}
        {{/if}}
      </InfoTableRow>
    {{/if}}
  {{/let}}
{{/each}}