<form id="character-configuration" class="dialog-v2">

  {{!-- Defence Calculations --}}
  <div class="defences grid">
    <div class="content-wrapper phisical">
      <div class="header"> 
        <label>{{localize "dc20rpg.dialog.config.defence.precision.title"}}</label>
      </div>
      <div class="content">
        <div class="row ignore-symetry" title="{{localize "dc20rpg.dialog.config.defence.formulaSelected"}}">
          <i class="fa-solid fa-pen-to-square fa-lg margin-left-3"></i>
          <select class="selectable" data-path="defences.precision.formulaKey">
            {{selectOptions config.DROPDOWN_DATA.precisionDefenceFormulasLabels selected=defences.precision.formulaKey}}
          </select>
        </div>
        {{#ifCond defences.precision.formulaKey '===' "flat"}}
        <input class="numeric-input labelless-row margin-top-5" type="number" value="{{defences.precision.normal}}" data-path="defences.precision.normal" title="{{localize "dc20rpg.dialog.config.defence.flat"}}"/>
        {{else}}
          {{#ifCond defences.precision.formulaKey '===' "custom"}}
          <input class="input labelless-row margin-top-5" type="text" value="{{defences.precision.customFormula}}" data-path="defences.precision.customFormula" title="{{localize "dc20rpg.dialog.config.defence.formulaCustom"}}"/>
          {{else}}
          <input disabled class="input labelless-row margin-top-5" type="text" value="{{selectedPrecisionFormula}}" title="{{localize "dc20rpg.dialog.config.defence.formula"}}"/>
          {{/ifCond}}
        {{/ifCond}}
      </div>
    </div>

    <div class="content-wrapper area">
      <div class="header"> 
        <label>{{localize "dc20rpg.dialog.config.defence.area.title"}}</label>
      </div>
      <div class="content">
        <div class="row ignore-symetry" title="{{localize "dc20rpg.dialog.config.defence.formulaSelected"}}">
          <i class="fa-solid fa-pen-to-square fa-lg margin-left-3"></i>
          <select class="selectable" data-path="defences.area.formulaKey">
            {{selectOptions config.DROPDOWN_DATA.areaDefenceFormulasLabels selected=defences.area.formulaKey}}
          </select>
        </div>
        {{#ifCond defences.area.formulaKey '===' "flat"}}
        <input class="numeric-input labelless-row margin-top-5" type="number" value="{{defences.area.normal}}" data-path="defences.area.normal" title="{{localize "dc20rpg.dialog.config.defence.flat"}}"/>
        {{else}}
          {{#ifCond defences.area.formulaKey '===' "custom"}}
          <input class="input labelless-row margin-top-5" type="text" value="{{defences.area.customFormula}}" data-path="defences.area.customFormula" title="{{localize "dc20rpg.dialog.config.defence.formulaCustom"}}"/>
          {{else}}
          <input disabled class="input labelless-row margin-top-5" type="text" value="{{selectedAreaFormula}}" title="{{localize "dc20rpg.dialog.config.defence.formula"}}"/>
          {{/ifCond}}
        {{/ifCond}}
      </div>
    </div>
  </div>

  {{!-- Rest Point --}}
  <div class="content-wrapper speed margin-top-5">
    <div class="header"> 
      <label>{{localize "dc20rpg.dialog.config.maxPoints.header"}}</label>
    </div>
    <div class="content">
      <input class="input labelless-row" type="text" value="{{resources.stamina.maxFormula}}" data-path="resources.stamina.maxFormula" title="{{localize "dc20rpg.dialog.config.maxPoints.stamina"}}"/>
      <input class="input labelless-row margin-top-3" type="text" value="{{resources.mana.maxFormula}}" data-path="resources.mana.maxFormula" title="{{localize "dc20rpg.dialog.config.maxPoints.mana"}}"/>
      <input class="input labelless-row margin-top-3" type="text" value="{{resources.grit.maxFormula}}" data-path="resources.grit.maxFormula" title="{{localize "dc20rpg.dialog.config.maxPoints.grit"}}"/>
    </div>
  </div>

  {{!-- Speed --}}
  <div class="content-wrapper speed margin-top-5">
    <div class="header"> 
      <label>{{localize "dc20rpg.dialog.config.movement.title"}}</label>
    </div>
    <div class="content">
      {{#each movement as |speed key|}}
      <div class="row ignore-symetry margin-bottom-3">
        <span>{{varLocalize 'dc20rpg.dialog.config.movement.' key '.useCustom'}}</span>
        <div class="input-select">
          {{#if speed.useCustom}}
          <input class="numeric-input flat-value short margin-right-3" type="number" value="{{speed.value}}" data-path="movement.{{key}}.value" title="{{varLocalize 'dc20rpg.dialog.config.movement.' key '.speed'}}"/>
          {{/if}}
          <a class="activable" data-path="movement.{{key}}.useCustom">
            <i class="fa-2x {{#if speed.useCustom}}fa-solid fa-square-check{{else}}fa-regular fa-square{{/if}}"></i>
          </a>
        </div>
      </div>
      {{/each}}
    </div>
  </div>

  {{!-- Jump --}}
  <div class="content-wrapper jump margin-top-5">
    <div class="header"> 
      <label>{{localize "dc20rpg.dialog.config.jump.title"}}</label>
    </div>
    <div class="content">
      <div class="row ignore-symetry" title="{{localize "dc20rpg.dialog.config.jump.key"}}">
        <span>{{localize "dc20rpg.dialog.config.jump.key"}}</span>
        <div class="input-select">
          {{#ifCond jump.key '===' "flat"}}
          <input class="numeric-input flat-value short margin-right-3" type="number" value="{{jump.value}}" data-path="jump.value"/>
          {{/ifCond}}
          <select class="selectable" data-path="jump.key">
            {{selectOptions config.DROPDOWN_DATA.jumpCalculationKeys selected=jump.key}}
          </select>
        </div>
      </div>
    </div>
  </div>

  {{!-- Size --}}
  <div class="content-wrapper jump margin-top-5">
    <div class="header"> 
      <label>{{localize "dc20rpg.dialog.config.size.title"}}</label>
    </div>
    <div class="content">
      <div class="row ignore-symetry">
        <span>{{localize "dc20rpg.dialog.config.size.fromAncestry"}}</span>
        <div class="input-select">
          {{#unless size.fromAncestry}}
          <select class="selectable margin-right-3" data-path="size.size" title="{{localize "dc20rpg.dialog.config.size.selectSize"}}">
            {{selectOptions config.DROPDOWN_DATA.sizes selected=size.size}}
          </select>
          {{/unless}}
          <a class="activable" data-path="size.fromAncestry" title="{{localize 'dc20rpg.dialog.config.size.fromAncestry'}}">
            <i class="fa-2x {{#if size.fromAncestry}}fa-solid fa-square-check{{else}}fa-regular fa-square{{/if}}"></i>
          </a>
        </div>
      </div>
    </div>
  </div>

  {{!-- Senses --}}
  <div class="content-wrapper sense margin-top-5">
    <div class="header"> 
      <label>{{localize "dc20rpg.dialog.config.senses.title"}}</label>
    </div>
    <div class="content">
      {{#each senses as |sense key|}}
      <div class="row ignore-symetry margin-bottom-3">
        <span>{{varLocalize 'dc20rpg.dialog.config.senses.' key '.override'}}</span>
        <div class="input-select">
          {{#if sense.override}}
          <input class="numeric-input flat-value short margin-right-3" type="number" value="{{sense.overridenRange}}" data-path="senses.{{key}}.overridenRange" title="{{varLocalize 'dc20rpg.dialog.config.senses.' key '.range'}}"/>
          {{/if}}
          <a class="activable" data-path="senses.{{key}}.override">
            <i class="fa-2x {{#if sense.override}}fa-solid fa-square-check{{else}}fa-regular fa-square{{/if}}"></i>
          </a>
        </div>
      </div>
      {{/each}}
    </div>
  </div>

  {{!-- Max Points --}}
  <div class="content-wrapper maxPoints margin-top-5">
    <div class="header"> 
      <label>{{localize "dc20rpg.dialog.config.maxPoints.title"}}</label>
    </div>
    <div class="content">
      {{!-- Attribute --}}
      <div class="row ignore-symetry margin-bottom-3">
        <span>{{localize 'dc20rpg.dialog.config.maxPoints.attribute.override'}}</span>
        <div class="input-select">
          {{#if attributePoints.override}}
          <input class="numeric-input flat-value short margin-right-3" type="number" value="{{attributePoints.overridenMax}}" data-path="attributePoints.overridenMax" title="{{localize 'dc20rpg.dialog.config.maxPoints.attribute.value'}}"/>
          {{/if}}
          <a class="activable" data-path="attributePoints.override">
            <i class="fa-2x {{#if attributePoints.override}}fa-solid fa-square-check{{else}}fa-regular fa-square{{/if}}"></i>
          </a>
        </div>
      </div>

      {{!-- Skills --}}
      {{#each skillPoints as |skill key|}}
      <div class="row ignore-symetry margin-bottom-3">
        <span>{{varLocalize 'dc20rpg.dialog.config.maxPoints.' key '.override'}}</span>
        <div class="input-select">
          {{#if skill.override}}
          <input class="numeric-input flat-value short margin-right-3" type="number" value="{{skill.overridenMax}}" data-path="skillPoints.{{key}}.overridenMax" title="{{varLocalize 'dc20rpg.dialog.config.maxPoints.' key '.value'}}"/>
          {{/if}}
          <a class="activable" data-path="skillPoints.{{key}}.override">
            <i class="fa-2x {{#if skill.override}}fa-solid fa-square-check{{else}}fa-regular fa-square{{/if}}"></i>
          </a>
        </div>
      </div>
      {{/each}}
    </div>
  </div>

  {{!-- Save Button --}}
  <button class="margin-top-5 button close save">{{localize "dc20rpg.dialog.config.update"}}</button>
</form>