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

<PageHeader as |p|>
  <p.top>
    <Hds::Breadcrumb>
      <Hds::Breadcrumb::Item
        @text="Scopes"
        @route="vault.cluster.access.oidc.scopes"
        data-test-breadcrumb-link="oidc-scopes"
      />
      <Hds::Breadcrumb::Item @text={{this.model.name}} @current={{true}} />
    </Hds::Breadcrumb>
  </p.top>
  <p.levelLeft>
    <h1 class="title is-3" data-test-oidc-scope-header>
      {{this.model.name}}
    </h1>
  </p.levelLeft>
</PageHeader>

<div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless">
  <nav class="tabs" aria-label="tabs">
    <ul>
      <LinkTo @route="vault.cluster.access.oidc.scopes.scope.details" @model={{this.model}} data-test-oidc-scope-details>
        Details
      </LinkTo>
    </ul>
  </nav>
</div>

<Toolbar>
  <ToolbarActions>
    {{#if this.model.canDelete}}
      <ConfirmAction
        data-test-oidc-scope-delete
        @buttonText="Delete scope"
        class="toolbar-button"
        @buttonColor="secondary"
        @onConfirmAction={{this.delete}}
        @confirmTitle="Delete scope?"
        @confirmMessage="This scope will be permanently deleted. You will not be able to recover it."
      />
      <div class="toolbar-separator"></div>
    {{/if}}
    {{#if this.model.canEdit}}
      <ToolbarLink @route="vault.cluster.access.oidc.scopes.scope.edit" @model={{this.model.name}} data-test-oidc-scope-edit>
        Edit scope
      </ToolbarLink>
    {{/if}}
  </ToolbarActions>
</Toolbar>

<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
  <InfoTableRow @label="Name" @value={{this.model.name}} />
  <InfoTableRow @label="Description" @value={{this.model.description}} />
  <Hds::CodeBlock @value={{this.model.template}} @language="ruby" @hasCopyButton={{true}} as |CB|>
    <CB.Title @tag="h3">
      JSON Template
    </CB.Title>
  </Hds::CodeBlock>
</div>