<fieldset class="basics">
    <div class="form-group">
        <label for="{{fieldIdPrefix}}category">{{localize "PF2E.Category"}}</label>
        <select id="{{fieldIdPrefix}}category" data-property="system.category">
            {{#select data.category}}
                {{#each categories as |name type|}}
                    <option value="{{type}}">{{localize name}}</option>
                {{/each}}
            {{/select}}
        </select>
    </div>

    {{#unless item.isBarding}}
        <div class="form-group">
            <label for="{{fieldIdPrefix}}group">{{localize "PF2E.ArmorGroupLabel"}}</label>
            <select id="{{fieldIdPrefix}}group" data-property="system.group">
                {{#select item.group}}
                    <option value=""></option>
                    {{#each groups as |name type|}}
                        <option value="{{type}}">{{localize name}}</option>
                    {{/each}}
                {{/select}}
            </select>
        </div>

        <div class="form-group">
            <label for="{{fieldIdPrefix}}base">{{localize "PF2E.Item.Physical.Base"}}</label>
            <select id="{{fieldIdPrefix}}base" data-property="system.baseItem">
                {{#select item.baseType}}
                    <option value=""></option>
                    {{#each baseTypes as |name slug|}}
                        <option value="{{slug}}">{{localize name}}</option>
                    {{/each}}
                {{/select}}
            </select>
        </div>
    {{/unless}}

    <div class="form-group">
        <label for="{{fieldIdPrefix}}ac-bonus">{{localize "PF2E.ArmorArmorLabel"}}</label>
        <input
            type="number"
            id="{{fieldIdPrefix}}ac-bonus"
            value="{{item.system.acBonus}}"
            data-property="system.acBonus"
            {{#if (gt item.acBonus item._source.system.acBonus)}}
                class="adjusted-higher"
            {{else if (lt item.acBonus item._source.system.acBonus)}}
                class="adjusted-lower"
            {{/if}}
        />
    </div>

    <div class="form-group">
        <label>{{localize "PF2E.ArmorDexLabel"}}</label>
        <input
            type="number"
            value="{{data.dexCap}}"
            data-property="system.dexCap"
            {{#if (gt item.dexCap item._source.system.dexCap)}}
                class="adjusted-higher"
            {{else if (lt item.dexCap item._source.system.dexCap)}}
                class="adjusted-lower"
            {{/if}}
        />
    </div>

    <div class="form-group">
        <label>{{localize "PF2E.ArmorCheckLabel"}}</label>
        <input
            type="number"
            value="{{data.checkPenalty}}"
            data-property="system.checkPenalty"
            {{#if (gt item.checkPenalty item._source.system.checkPenalty)}}
                class="adjusted-higher"
            {{else if (lt item.checkPenalty item._source.system.checkPenalty)}}
                class="adjusted-lower"
            {{/if}}
        />
    </div>

    <div class="form-group">
        <label for="{{fieldIdPrefix}}speed-penalty">{{localize "PF2E.ArmorSpeedLabel"}}</label>
        <input
            type="number"
            id="{{fieldIdPrefix}}speed-penalty"
            value="{{data.speedPenalty}}"
            data-property="system.speedPenalty"
            {{#if (gt item.speedPenalty item._source.system.speedPenalty)}}
                class="adjusted-higher"
            {{else if (lt item.speedPenalty item._source.system.speedPenalty)}}
                class="adjusted-lower"
            {{/if}}
        />
    </div>

    <div class="form-group">
        <label>{{localize "PF2E.ArmorStrengthLabel"}}</label>
        <input
            type="number"
            value="{{data.strength}}"
            placeholder="—"
            data-property="system.strength"
            {{#if (gt item.strength item._source.system.strength)}}
                class="adjusted-lower"
            {{else if (lt item.strength item._source.system.strength)}}
                class="adjusted-higher"
            {{/if}}
        />
    </div>

    <div class="form-group">
        <label>{{localize "PF2E.HardnessLabel"}}</label>
        <input
            type="number"
            {{#if (gt item.hardness item._source.system.hardness)}}class="adjusted-higher"{{else if (lt item.hardness item._source.system.hardness)}}class="adjusted-lower"{{/if}}
            data-property="system.hardness" value="{{item.hardness}}"
        />
    </div>

    <div class="form-group">
        <label for="{{fieldIdPrefix}}hp">{{localize "PF2E.HitPointsHeader"}}</label>
        <div class="form-fields">
            <input id="{{fieldIdPrefix}}hp" type="number" name="system.hp.value" value="{{data.hp.value}}" />
            /
            <input type="number"
                {{#if (gt item.system.hp.max item._source.system.hp.max)}}
                    class="adjusted-higher"
                {{else if (lt item.system.hp.max item._source.system.hp.max)}}
                    class="adjusted-lower"
                {{/if}}
                data-property="system.hp.max"
                value="{{data.hp.max}}" />
        </div>
    </div>
</fieldset>

<fieldset>
    <legend>{{localize "PF2E.Item.Physical.MaterialRunes.Label"}}</legend>
    <div class="form-group">
        <label>{{localize "PF2E.PreciousMaterialLabel"}}</label>
        <select data-property="system.material" data-value-base="{{json item._source.system.material}}" data-dtype="JSON">
            {{#select preciousMaterials.value}}
                <option value="{&quot;type&quot;:null,&quot;grade&quot;:null}"></option>
                {{#each preciousMaterials.materials as |material|}}
                    <optgroup label="{{material.label}}">
                        {{#each material.grades as |grade|}}
                            <option value="{{grade.value}}">
                                {{localize "PF2E.Item.Weapon.MaterialAndRunes.MaterialOption" type=material.label grade=grade.label}}
                            </option>
                        {{/each}}
                    </optgroup>
                {{/each}}
            {{/select}}
        </select>
    </div>

    {{#unless (or item.isBarding abpEnabled)}}
        {{#unless abpEnabled}}
            <div class="form-group">
                <label for="{{fieldIdPrefix}}rune-potency">{{localize "PF2E.PotencyRuneLabel"}}</label>
                <select name="system.runes.potency" id="{{fieldIdPrefix}}rune-potency" data-dtype="Number">
                    {{#select data.runes.potency}}
                        {{#each runeTypes.potency as |data number|}}
                            <option value="{{number}}">{{localize (coalesce data.name "")}}</option>
                        {{/each}}
                    {{/select}}
                </select>
            </div>
            <div class="form-group">
                <label for="{{fieldIdPrefix}}rune-resilient">{{localize "PF2E.Item.Armor.Rune.Resilient.Label"}}</label>
                <select name="system.runes.resilient" id="{{fieldIdPrefix}}rune-resilient" data-dtype="Number">
                    {{#select data.runes.resilient}}
                        {{#each runeTypes.resilient as |data number|}}
                            <option value="{{number}}">{{localize (coalesce data.name "")}}</option>
                        {{/each}}
                    {{/select}}
                </select>
            </div>
        {{/unless}}

        {{#each propertyRuneSlots as |slot index|}}
            <div class="form-group">
                <label
                    for="{{../fieldIdPrefix}}runes-property-{{index}}"
                    {{#if slot.disabled}}class="disabled"{{/if}}
                >
                    {{localize (concat "PF2E.PropertyRuneLabel" (add index 1))}}
                </label>
                <select
                    name="system.runes.property.{{index}}"
                    id="{{../fieldIdPrefix}}runes-property-{{index}}"
                    {{disabled slot.disabled}}
                    {{#if slot.readOnly}}class="readonly"{{/if}}
                >
                    {{#select slot.slug}}
                        <option value=""></option>
                        {{#each @root.runeTypes.property as |rune|}}
                            <option value="{{rune.slug}}">{{localize rune.name}}</option>
                        {{/each}}
                    {{/select}}
                </select>
            </div>
        {{/each}}

        <div class="form-group">
            <label class="large">
                {{localize "PF2E.Item.Armor.Specific.Label"}}
                <i class="fa-solid fa-info-circle" data-tooltip="PF2E.Item.Armor.Specific.Hint"></i>
            </label>
            <input
                type="checkbox"
                name="system.specific"
                value="{{json specificMagicData}}"
                data-dtype="JSON"
                {{checked data.specific}}
            />
        </div>
    {{/unless}}
</fieldset>


<div class="form-group stacked">
    <label>
        {{localize "PF2E.Item.Physical.OtherTags.Label"}}
        <i class="fa-solid fa-info-circle" data-tooltip="PF2E.Item.Physical.OtherTags.Hint"></i>
        {{#if editable}}
            <a class="tag-selector" data-tag-selector="basic" data-config-types="otherArmorTags" data-title="PF2E.Item.Physical.OtherTags.Label" data-property="system.traits.otherTags"><i class="fa-solid fa-edit"></i></a>
        {{/if}}
    </label>
    <ul class="traits-list tags">
        {{#each otherTags as |tag|}}
            <li class="tag tag_alt">{{tag.label}}</li>
        {{/each}}
    </ul>
</div>

