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

{{#if (eq @mode "create")}} Create Role {{else if (eq @mode "edit")}} Edit Role {{else}} {{@model.id}} {{/if}}

{{#if (eq @mode "show")}} {{#if @model.canDelete}}
{{/if}} {{#if (and @model.canRotateRoleCredentials (eq @model.type "static"))}} {{/if}} {{#if (or (and (eq @model.type "static") @model.canGetCredentials) (and (eq @model.type "dynamic") @model.canGenerateCredentials) ) }} {{/if}} {{#if @model.canEditRole}} Edit role {{/if}}
{{#each @model.showFields as |attr|}} {{#let attr.options.defaultShown as |defaultDisplay|}} {{#if (eq attr.type "object")}} {{else if (eq attr.options.editType "ttl")}} {{else if (eq attr.name "skip_import_rotation")}} {{else}} {{/if}} {{/let}} {{/each}} {{else}} {{! Edit or Create }}
{{#each @model.fieldAttrs as |attr|}} {{#if (eq @mode "edit")}} {{else if (not-eq attr.options.readOnly true)}} {{#if (eq attr.name "type")}} {{#if @model.database}} {{/if}} {{else}} {{/if}} {{! TODO: If database && !updateDB show warning }} {{#if (get this.warningMessages attr.name)}} Warning {{get this.warningMessages attr.name}} {{/if}} {{/if}} {{/each}} {{#if @model.database}} {{else}} {{/if}}
{{#if this.invalidFormAlert}} {{/if}} {{#if (not (is-empty-value this.warningMessages))}} Warning You don't have permissions required to {{if (eq @mode "create") "create" "update"}} this role. See form for details. {{/if}}
{{/if}} {{#if this.saveIssuerWarning}} Are you sure?

{{this.saveIssuerWarning}}

{{/if}}