<section
    class='tab {{tabs.summary.cssClass}} {{tabs.summary.id}}'
    data-tab='{{tabs.summary.id}}'
    data-group='{{tabs.summary.group}}'
>

    <div class="summary-header">
        <side-line-div class="invert"></side-line-div>
        <h3>{{localize tabs.summary.label}}</h3>
        <side-line-div></side-line-div>
    </div>

    <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">
                                <span>
                                    {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.proficiencyIncrease" proficiency=this.achievements.proficiency.old }}
                                </span>
                                <i class="fa-solid fa-arrow-right-long"></i>
                                <span>
                                    {{this.achievements.proficiency.new}}
                                </span>
                            </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">
                                <span>
                                    {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.damageThresholdMajorIncrease" threshold=this.achievements.damageThresholds.major.old }}
                                </span>
                                <i class="fa-solid fa-arrow-right-long"></i>
                                <span>
                                    {{this.achievements.damageThresholds.major.new}}
                                </span>
                            </div>
                            <div class="increase-container">
                                <span>
                                    {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.damageThresholdSevereIncrease" threshold=this.achievements.damageThresholds.severe.old }}
                                </span>
                                <i class="fa-solid fa-arrow-right-long"></i>
                                <span>
                                    {{this.achievements.damageThresholds.severe.new}}
                                </span>
                            </div>
                        </div>
                    {{/if}}
                    {{#if this.achievements.domainCards.shown}}
                        <div>
                            <h5 class="summary-section">{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.domainCards"}}</h5>
                            <div class="summary-selection-container">
                                {{#each this.achievements.domainCards.values}}
                                    <span class="summary-selection">{{this.name}}</span>
                                {{/each}}
                            </div>
                        </div>
                    {{/if}}
                    {{#if this.achievements.experiences.shown}}
                        <div>
                            <h5 class="summary-section">{{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.newExperiences"}}</h5>
                            <div class="summary-selection-container">
                                {{#each this.achievements.experiences.values}}
                                    <span class="summary-selection">{{this.name}} {{numberFormat this.modifier sign=true}}</span>
                                {{/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">
                                <span>
                                    {{localize "DAGGERHEART.APPLICATIONS.Levelup.summary.proficiencyIncrease" proficiency=this.advancements.statistics.proficiency.old }}
                                </span>
                                <i class="fa-solid fa-arrow-right-long"></i>
                                <span>
                                    {{this.advancements.statistics.proficiency.new}}
                                </span>
                            </div>
                        {{/if}}

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

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

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

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

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

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

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

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