<fieldset class="basics">
    {{> "systems/pf2e/templates/items/partials/apex.hbs"}}
    <div class="form-group">
        <label for="{{fieldIdPrefix}}base">{{localize "PF2E.Item.Physical.Base"}}</label>
        <select id="{{fieldIdPrefix}}base" data-property="system.baseItem">
            {{selectOptions baseTypes selected=data.baseItem blank=""}}
        </select>
    </div>

    <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 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>

    <div class="form-group">
        <label for="{{fieldIdPrefix}}hardness">{{localize "PF2E.HardnessLabel"}}</label>
        <input
            type="number"{{#if (gt item.hardness baseHardness)}} class="adjusted-higher"{{else if (lt item.hardness baseHardness)}} class="adjusted-lower"{{/if}}
            id="{{fieldIdPrefix}}hardness"
            data-property="system.hardness"
            value="{{item.hardness}}"
        />
    </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>
</fieldset>

<fieldset class="material-runes">
    <legend>{{localize "PF2E.Item.Physical.MaterialRunes.Label"}}</legend>
    <div class="form-group">
        <label
            for="{{fieldIdPrefix}}material"
            {{#unless canChangeMaterial}}class="disabled"{{/unless}}
        >{{localize "PF2E.PreciousMaterialLabel"}}</label>
        <select
            id="{{fieldIdPrefix}}material"
            data-property="system.material"
            data-value-base="{{json item._source.system.material}}"
            data-dtype="JSON"
            {{disabled (not canChangeMaterial)}}
        >
            {{selectOptions preciousMaterials.materials selected=preciousMaterials.value}}
        </select>
    </div>

    <div class="form-group">
        <label for="{{fieldIdPrefix}}runes-reinforcing">{{localize "PF2E.Item.Shield.Rune.Reinforcing.Label"}}</label>
        <select name="system.runes.reinforcing" id="{{fieldIdPrefix}}runes-reinforcing" data-dtype="Number">
            <option value="0"></option>
            {{selectOptions (omit reinforcing 0) selected=data.runes.reinforcing localize=true}}
        </select>
    </div>

    {{#if weaponRunes}}
        <div class="form-group">
            <label for="{{fieldIdPrefix}}integrated-potency">{{localize "PF2E.PotencyRuneLabel"}}</label>
            <select name="system.traits.integrated.runes.potency" id="{{fieldIdPrefix}}integrated-potency" data-dtype="Number">
                <option value="0"></option>
                {{selectOptions (omit weaponRunes.potency 0) selected=data.traits.integrated.runes.potency labelAttr="name" localize=true}}
            </select>
        </div>

        <div class="form-group">
            <label for="{{fieldIdPrefix}}integrated-runes-potency">{{localize "PF2E.StrikingRuneLabel"}}</label>
            <select name="system.traits.integrated.runes.striking" id="{{fieldIdPrefix}}integrated-runes-potency" data-dtype="Number">
                <option value="0"></option>
                {{selectOptions (omit weaponRunes.striking 0) selected=data.traits.integrated.runes.striking labelAttr="name" localize=true}}
            </select>
        </div>

        {{#each propertyRuneSlots as |slot index|}}
            <div class="form-group">
                <label
                    for="{{../fieldIdPrefix}}integrated-runes-property-{{index}}"
                    {{#if slot.disabled}}class="disabled"{{/if}}
                >
                    {{localize (concat "PF2E.PropertyRuneLabel" (add index 1))}}
                </label>
                <select
                    name="system.traits.integrated.runes.property.{{index}}"
                    id="{{../fieldIdPrefix}}integrated-runes-property-{{index}}"
                    {{disabled slot.disabled}}
                    {{#if slot.readOnly}}class="readonly"{{/if}}
                >
                    {{selectOptions @root.weaponRunes.property selected=slot.slug valueAttr="slug" labelAttr="name" blank="" localize=true}}
                </select>
            </div>
        {{/each}}
    {{/if}}

    <div class="form-group">
        <label for="{{fieldIdPrefix}}specific" class="large">
            {{localize "PF2E.Item.Shield.Specific.Label"}}
            <i class="fa-solid fa-circle-info" data-tooltip="PF2E.Item.Shield.Specific.Hint"></i>
        </label>
        <input type="checkbox" id="{{fieldIdPrefix}}specific" data-action="toggle-specific" {{checked data.specific}} />
    </div>
</fieldset>

