{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<PageHeader as |p|>
  <p.top>
    <KeyValueHeader
      @baseKey={{this.model}}
      @path="vault.cluster.secrets.backend"
      @root={{this.root}}
      @showCurrent={{true}}
    />
  </p.top>
  <p.levelLeft>
    <h1 class="title is-3">
      Configure
      {{get (options-for-backend this.model.type) "displayName"}}
    </h1>
  </p.levelLeft>
</PageHeader>

<Toolbar>
  <ToolbarActions>
    <ToolbarLink @route="vault.cluster.secrets.backend" @model={{this.model.id}} data-test-backend-view-link>
      View backend
    </ToolbarLink>
  </ToolbarActions>
</Toolbar>

{{#if (eq this.model.type "aws")}}
  <ConfigureAwsSecret
    @model={{this.model}}
    @tab={{this.tab}}
    @accessKey={{this.accessKey}}
    @secretKey={{this.secretKey}}
    @region={{this.region}}
    @iamEndpoint={{this.iamEndpoint}}
    @stsEndpoint={{this.stsEndpoint}}
    @saveAWSRoot={{action "save" "saveAWSRoot"}}
    @saveAWSLease={{action "save" "saveAWSLease"}}
  />
{{else if (eq this.model.type "ssh")}}
  <ConfigureSshSecret
    @model={{this.model}}
    @configured={{this.configured}}
    @saveConfig={{action "saveConfig"}}
    @loading={{this.loading}}
  />
{{/if}}

{{outlet}}