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

<KvPageHeader @breadcrumbs={{@breadcrumbs}} @pageTitle="Create Secret">
  <:toolbarFilters>
    <Toggle @name="json" @checked={{this.showJsonView}} @onChange={{fn (mut this.showJsonView)}}>
      <span class="has-text-grey">JSON</span>
    </Toggle>
  </:toolbarFilters>
</KvPageHeader>

<KvCreateEditForm
  @form={{@form}}
  @path={{@path}}
  @backend={{@backend}}
  @showJson={{this.showJsonView}}
  as |modelValidations|
>
  <ToggleButton
    @isOpen={{this.showMetadata}}
    @openLabel="Hide secret metadata"
    @closedLabel="Show secret metadata"
    @onClick={{fn (mut this.showMetadata)}}
    class="is-block"
    data-test-metadata-toggle
  />
  {{#if this.showMetadata}}
    <div class="box has-container" data-test-metadata-section>
      <KvMetadataFields @form={{@form}} @modelValidations={{modelValidations}} />
    </div>
  {{/if}}
</KvCreateEditForm>