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

{{page-title "Edit Variable"}}
<Hds::PageHeader class="variable-title" as |PH|>
  <PH.Title>Editing {{this.model.path}}</PH.Title>
  <PH.IconTile @icon="file-text" />
  <PH.Actions>
    <Hds::Form::Toggle::Field
      @value="enable"
      {{keyboard-shortcut 
        label="Toggle View (JSON/List)"
        pattern=(array "j")
        action=(action this.toggleView)
      }}
      checked={{eq this.view "json"}}
      data-test-json-toggle
      {{on "change" (action this.toggleView)}}
    as |F|>
      <F.Label>JSON</F.Label>
    </Hds::Form::Toggle::Field>
  </PH.Actions>
  <PH.Breadcrumb>
    <Hds::Breadcrumb>
      <Hds::Breadcrumb::Item @text="Back" @route="variables.variable.index" @icon="chevron-left" />
    </Hds::Breadcrumb>
  </PH.Breadcrumb>
</Hds::PageHeader>

<VariableForm
  @model={{this.model}}
  @existingVariables={{this.existingVariables}}
  @view={{this.view}}
/>
