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

{{#if this.showActionTypes}}
  <div class="box is-bottomless is-fullwidth is-marginless">
    <div class="columns">
      {{#each this.configTypes as |option|}}
        <div class="column is-flex">
          <label for={{option.key}} class="box-label is-column {{if (eq this.actionType option.key) 'is-selected'}}">
            <div>
              <h3 class="box-label-header title is-6">
                <Icon @size="24" @name={{option.icon}} />
                {{option.label}}
              </h3>
              <p class="help has-text-grey-dark">
                {{option.description}}
              </p>
            </div>
            <div>
              <RadioButton
                id={{option.key}}
                name="pki-config-type"
                @value={{option.key}}
                @groupValue={{this.actionType}}
                @onChange={{fn (mut this.actionType) option.key}}
                data-test-pki-config-option={{option.key}}
              />
              <label for={{option.key}}></label>
            </div>
          </label>
        </div>
      {{/each}}
    </div>
  </div>
{{else}}
  <Toolbar />
{{/if}}

{{#if (eq this.actionType "import")}}
  <PkiImportPemBundle
    @useIssuer={{@capabilities.canImportBundle}}
    @onCancel={{@onCancel}}
    @onSave={{this.onSave "View imported items"}}
    @onComplete={{transition-to "vault.cluster.secrets.backend.pki.overview"}}
  />
{{else if (eq this.actionType "generate-root")}}
  <PkiGenerateRoot
    @withUrls={{true}}
    @canSetUrls={{@capabilities.canSetUrls}}
    @onCancel={{@onCancel}}
    @onSave={{this.onSave "View Root Certificate"}}
    @onComplete={{transition-to "vault.cluster.secrets.backend.pki.overview"}}
  />
{{else if (eq this.actionType "generate-csr")}}
  <PkiGenerateCsr
    @onCancel={{@onCancel}}
    @onSave={{this.onSave "View Generated CSR"}}
    @onComplete={{transition-to "vault.cluster.secrets.backend.pki.overview"}}
  />
{{else}}
  <EmptyState @title="Choose an option" @message="To see configuration options, choose your desired output above." />
  <hr class="has-background-gray-100" />
  <Hds::ButtonSet>
    <Hds::Button @text="Done" disabled={{true}} data-test-submit />
    <Hds::Button @text="Cancel" @color="secondary" {{on "click" @onCancel}} data-test-cancel />
  </Hds::ButtonSet>
{{/if}}