<form>
    <div class="dialog-content" autocomplete="off">
        <div class="form-group">
            <label>{{localize "PF2E.SpellcastingTypeLabel"}}</label>
            <select name="system.prepared.value" {{disabled object.id}}>
                {{#select data.prepared.value}}
                    {{#each spellcastingTypes as |label mode|}}
                        <option value="{{mode}}">{{localize label}}</option>
                    {{/each}}
                {{/select}}
            </select>
        </div>
        {{#if object.isPrepared}}
            <div class="form-group">
                <label>{{localize "PF2E.SpellFlexibleLabel"}}</label>
                <input name="system.prepared.flexible" type="checkbox" {{checked data.prepared.flexible}}/>
            </div>
        {{/if}}
        {{#if (eq data.prepared.value "items")}}
            <div class="form-group">
                <label>{{localize "PF2E.Actor.Creature.Spellcasting.MagicItemTypesLabel"}}</label>
                <select name="system.prepared.validItems">
                    {{#select data.prepared.validItems}}
                        <option>{{localize "PF2E.Actor.Creature.Spellcasting.ValidItemTypes.All"}}</option>
                        <option value="scroll">{{localize "PF2E.Actor.Creature.Spellcasting.ValidItemTypes.Scroll"}}</option>
                    {{/select}}
                </select>
            </div>
        {{/if}}
        <hr/>

        {{#unless object.isRitual}}
            <div class="form-group">
                <label>{{localize "PF2E.MagicTraditionLabel"}}</label>
                <select name="system.tradition.value">
                    {{#select data.tradition.value}}
                        {{#if (eq data.prepared.value "items")}}
                            <option value="">{{localize "PF2E.MagicTraditionUseSpellLabel"}}</option>
                        {{/if}}
                        {{#each magicTraditions as |label mode|}}
                            <option value="{{mode}}">{{localize label}}</option>
                        {{/each}}
                    {{/select}}
                </select>
            </div>
            {{#if (eq actor.type "character")}}
                <div class="form-group">
                    <label>{{localize "PF2E.ProficiencyLabel"}}</label>
                    <select name="system.proficiency.slug">
                        {{#select data.proficiency.slug}}
                            {{#if data.tradition.value}}
                                <option value="">
                                    {{localize "PF2E.Actor.Creature.Spellcasting.TraditionSpellcasting" tradition=(localize (lookup @root.magicTraditions data.tradition.value))}}
                                </option>
                            {{/if}}
                            {{#each classDCs as |classDC|}}
                                <option value="{{classDC.slug}}">{{localize "PF2E.Actor.Character.ClassDC.LabelSpecific" class=classDC.label}}</option>
                            {{/each}}
                        {{/select}}
                    </select>
                </div>
            {{/if}}
            {{#if hasAbility}}
                <div class="form-group">
                    <label>{{localize "PF2E.SpellAbilityLabel"}}</label>
                    <select name="system.ability.value">
                        {{#select data.ability.value}}
                            {{#each abilities as |label key|}}
                                <option value="{{key}}">{{localize label}}</option>
                            {{/each}}
                        {{/select}}
                    </select>
                </div>
            {{/if}}
            {{#if (eq actor.type "npc")}}
                <div class="form-group">
                    <label>{{localize "PF2E.SpellcastingSettings.AutoHeightenLabel"}}</label>
                    <select name="system.autoHeightenLevel.value" data-dtype="Number">
                        {{#select data.autoHeightenLevel.value}}
                            <option>{{localize "PF2E.SpellcastingSettings.AutoHeightenDefault"}}</option>
                            {{#times 10}}
                                <option value="{{add this 1}}">{{localize "PF2E.SpellLevel" level=(ordinal (add this 1))}}</option>
                            {{/times}}
                        {{/select}}
                    </select>
                </div>
            {{/if}}
        {{/unless}}
    </div>
    <div class="dialog-buttons">
        <button type="submit" class="dialog-button finish default">
            {{#if object.id}}
                {{localize "PF2E.UpdateLabelUniversal"}}
            {{else}}
                {{localize "PF2E.CreateLabelUniversal"}}
            {{/if}}
        </button>
    </div>
    <form>
