<section
    class='tab {{tabs.summary.cssClass}} {{tabs.summary.id}}'
    data-tab='{{tabs.summary.id}}'
    data-group='{{tabs.summary.group}}'
>
    <div class="section-container levelup-summary-container">
        {{#if this.achievements}}
            <fieldset>
                <legend>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.levelAchievements"}}</legend>

                <div class="level-achievements-container">
                    {{#if this.achievements.proficiency.shown}}
                        <div>
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.proficiencyIncrease" proficiency=this.achievements.proficiency.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.achievements.proficiency.new}}
                            </div>
                        </div>
                    {{/if}}
                    {{#if this.achievements.damageThresholds}}
                        <div>
                            <h5 class="summary-section">{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.damageThresholds"}}{{#if this.levelAchievements.damageThresholds.unarmored}}({{localize "DAGGERHEART.GENERAL.unarmored"}}){{/if}}</h5>
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.damageThresholdMajorIncrease" threshold=this.achievements.damageThresholds.major.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.achievements.damageThresholds.major.new}}
                            </div>
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.damageThresholdSevereIncrease" threshold=this.achievements.damageThresholds.severe.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.achievements.damageThresholds.severe.new}}
                            </div>
                        </div>
                    {{/if}}
                    {{#if this.achievements.domainCards.shown}}
                        <div>
                            <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.domainCards"}}</h5>
                            <div class="summary-selection-container">
                                {{#each this.achievements.domainCards.values}}
                                    <div class="summary-selection">{{this.name}}</div>
                                {{/each}}
                            </div>
                        </div>
                    {{/if}}
                    {{#if this.achievements.experiences.shown}}
                        <div>
                            <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.newExperiences"}}</h5>
                            <div class="summary-selection-container">
                                {{#each this.achievements.experiences.values}}
                                    <div class="summary-selection">{{this.name}} {{numberFormat this.modifier sign=true}}</div>
                                {{/each}}
                            </div>
                        </div>
                    {{/if}}
                </div>
            </fieldset>
        {{/if}}
        <fieldset>
            <legend>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.levelAdvancements"}}</legend>

            <div class="level-advancements-container">
                {{#if this.advancements.statistics.shown}}
                    <div>
                        {{#if this.advancements.statistics.proficiency.shown}}
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.proficiencyIncrease" proficiency=this.advancements.statistics.proficiency.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.advancements.statistics.proficiency.new}}
                            </div>
                        {{/if}}

                        {{#if this.advancements.statistics.hitPoints.shown}}
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.hpIncrease" hitPoints=this.advancements.statistics.hitPoints.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.advancements.statistics.hitPoints.new}}
                            </div>
                        {{/if}}

                        {{#if this.advancements.statistics.stress.shown}}
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.stressIncrease" stress=this.advancements.statistics.stress.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.advancements.statistics.stress.new}}
                            </div>
                        {{/if}}
                        {{#if this.advancements.statistics.evasion.shown}}
                            <div class="increase-container">
                                {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.evasionIncrease" evasion=this.advancements.statistics.evasion.old }}
                                <i class="fa-solid fa-arrow-right-long"></i>
                                {{this.advancements.statistics.evasion.new}}
                            </div>
                        {{/if}}
                    </div>
                {{/if}}

                {{#if this.advancements.traits}}
                    <div>
                        <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.traits"}}</h5>
  
                            {{#each this.advancements.traits}}
                                <div class="increase-container">
                                    {{this.label}}: {{this.old}}
                                    <i class="fa-solid fa-arrow-right-long"></i>
                                    {{this.new}}
                                </div>
                            {{/each}}
                    </div>
                {{/if}}

                {{#if this.advancements.domainCards}}
                    <div>
                        <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.domainCards"}}</h5>
                        <div class="summary-selection-container">
                            {{#each this.advancements.domainCards}}
                                <div class="summary-selection">{{this.name}}</div>
                            {{/each}}
                        </div>
                    </div>
                {{/if}}

                {{#if this.advancements.experiences}}
                    <div>
                        <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.experienceIncreases"}}</h5>
                        <div class="summary-selection-container">
                            {{#each this.advancements.experiences}}
                                <div class="summary-selection">{{this.name}} {{numberFormat this.modifier sign=true}}</div>
                            {{/each}}
                        </div>
                    </div>
                {{/if}}

                {{#if this.advancements.subclass}}
                    <div>
                        <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.subclass"}}</h5>
                        <div class="summary-selection-container">
                            {{#each this.advancements.subclass}}
                                <div class="summary-selection">{{this.name}} - {{this.featureLabel}}</div>
                            {{/each}}
                        </div>
                    </div>
                {{/if}}

                {{#if this.advancements.multiclass}}
                    {{#with this.advancements.multiclass}}
                        <div>
                            <h5>{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.multiclass"}}</h5>
                            <div class="summary-selection-container">
                                <div class="summary-selection">{{this.name}}</div>
                                <div class="summary-selection">{{this.domain}}</div>
                                <div class="summary-selection">{{this.subclass}}</div>
                            </div>
                        </div>
                    {{/with}}
                {{/if}}

                {{#if this.advancements.vicious.damage}}
                     <div class="increase-container">
                        {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.damageIncreased" damage=this.advancements.vicious.damage.old }}
                        <i class="fa-solid fa-arrow-right-long"></i>
                        {{this.advancements.vicious.damage.new}}
                    </div>     
                {{/if}}
                {{#if this.advancements.vicious.range}}
                     <div class="increase-container">
                        {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.rangeIncreased" range=this.advancements.vicious.range.old }}
                        <i class="fa-solid fa-arrow-right-long"></i>
                        {{this.advancements.vicious.range.new}}
                    </div>     
                {{/if}}
                {{#each this.advancements.simple}}
                    <div class="summary-selection-container">
                        <div class="summary-selection">{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.simpleFeature" feature=this}}</div>
                    </div>
                {{/each}}
            </div>
        </fieldset>

        <footer class="levelup-footer">
            <button data-action="save" {{#if (not this.levelup.allLevelsFinished)}}disabled{{/if}}>{{localize "Finish Levelup"}}</button>
        </footer>
    </div>
</section>