<div class="row">
  <div class="col span-6">
    <label class="acc-label">
      {{t "cruPersistentVolume.secret.defaultMode.label"}}
    </label>
    {{#input-or-display editable=editing value=defaultMode}}
      {{input-integer
        type="text"
        value=defaultMode
        classNames="form-control"
        placeholder=(t "cruPersistentVolume.secret.defaultMode.placeholder")
      }}
    {{/input-or-display}}
  </div>

  <div class="col span-6">
    <label class="acc-label">
      {{t "cruPersistentVolume.secret.optional.label"}}
    </label>
    {{#if editing}}
      <div class="text-muted">
        <label>
          {{radio-button
            selection=config.optional
            value=true
          }} {{t "generic.yes"}}
        </label>
        <label>
          {{radio-button
            selection=config.optional
            value=false
          }} {{t "generic.no"}}
        </label>
      </div>
    {{else}}
      <div>
        {{config.optional}}
      </div>
    {{/if}}
  </div>
</div>
<div class="row mb-20">
  <div class="col span-6">
    <label class="acc-label">
      {{t "cruPersistentVolume.secret.secretName.label"}}
    </label>
    {{#if editing}}
      {{schema/input-secret
        namespace=namespace
        value=config.secretName
        valueKey="name"
      }}
    {{else}}
      <div>
        {{config.secretName}}
      </div>
    {{/if}}
  </div>
  {{#if config.secretName}}
    <div class="col span-6">
      <label class="acc-label">
        {{t "cruPersistentVolume.secret.items.label"}}
      </label>
      {{#if editing}}
        <div class="text-muted">
          <div>
            <label>
              {{radio-button
                selection=specific
                value=false
              }} {{t "formKeyToPath.default"}}
            </label>
          </div>
          <div>
            <label>
              {{radio-button
                selection=specific
                value=true
              }} {{t "formKeyToPath.specific"}}
            </label>
          </div>
        </div>
      {{else if specific}}
        <div>
          {{t "formKeyToPath.specific"}}
        </div>
      {{else if (not specific)}}
        <div>
          {{t "formKeyToPath.default"}}
        </div>
      {{/if}}
    </div>
  {{/if}}
</div>

{{#if (and config.secretName specific)}}
  <div class="row">
    <div class="col span-12">
      {{form-key-to-path
        initialItems=config.items
        secretName=config.secretName
        editing=editing
        changed=(action (mut config.items))
      }}
    </div>
  </div>
{{/if}}
