<div class="dnc-sheet dnc-item-sheet">
  <header class="sheet-header compact">
    <div class="portrait">
      <img src="{{item.img}}" alt="{{item.name}}">
      <button type="button" class="icon-button" data-action="editImage" aria-label="Modifier l'image" title="Modifier l'image"><i class="fa-solid fa-image"></i></button>
    </div>
    <div class="identity-grid two-columns">
      <label>
        <span>Nom</span>
        <input type="text" name="name" value="{{item.name}}">
      </label>
      {{#if isWeapon}}
        <label>
          <span>Categorie</span>
          <select name="system.categorie">{{selectOptions config.weaponCategoryOptions selected=system.categorie localize=false}}</select>
        </label>
        <div class="readonly-field">
          <span>Caracteristique</span>
          <p>{{weaponCharacteristicLabel}}</p>
        </div>
        <label>
          <span>Degats usage die (Δ)</span>
          <input type="checkbox" name="system.degatsEstUsageDe" {{checked system.degatsEstUsageDe}}>
        </label>
        {{#if system.degatsEstUsageDe}}
          <label>
            <span>Δ Degats courant</span>
            <select name="system.degatsDelta">{{selectOptions config.usageDieOptions selected=system.degatsDelta localize=false blank="Epuise"}}</select>
          </label>
        {{else}}
          <label>
            <span>Degats</span>
            <input type="text" name="system.degats" value="{{system.degats}}">
          </label>
        {{/if}}
        <label>
          <span>Munitions</span>
          <select name="system.munitionsDelta">{{selectOptions config.usageDieOptions selected=system.munitionsDelta localize=false blank="Aucune"}}</select>
        </label>
        <label>
          <span>Portee</span>
          <input type="text" name="system.portee" value="{{system.portee}}">
        </label>
        <label>
          <span>Mains</span>
          <input type="number" name="system.mains" value="{{system.mains}}">
        </label>
      {{/if}}

      {{#if isArmor}}
        <label>
          <span>Protection</span>
          <select name="system.delta">{{selectOptions config.usageDieOptions selected=system.delta localize=false}}</select>
        </label>
        <div class="readonly-field">
          <span>Protection stockee</span>
          <p>{{armorProtectionDisplay}}</p>
        </div>
        <label>
          <span>Encombrement</span>
          <input type="text" name="system.encombrement" value="{{system.encombrement}}">
        </label>
      {{/if}}

      {{#if isConsumable}}
        <label>
          <span>Quantite</span>
          <input type="number" name="system.quantite" value="{{system.quantite}}">
        </label>
        <label>
          <span>De d'usure</span>
          <select name="system.delta">{{selectOptions config.usageDieOptions selected=system.delta localize=false}}</select>
        </label>
        <label class="span-two">
          <span>Effet</span>
          <input type="text" name="system.effet" value="{{system.effet}}">
        </label>
      {{/if}}

      {{#if isEquipment}}
        <label>
          <span>Quantite</span>
          <input type="number" name="system.quantite" value="{{system.quantite}}">
        </label>
        <label>
          <span>Emplacement</span>
          <input type="text" name="system.emplacement" value="{{system.emplacement}}">
        </label>
      {{/if}}

      {{#if isTraining}}
        <label>
          <span>De d'usure courant</span>
          <select name="system.delta">{{selectOptions config.usageDieOptions selected=system.delta localize=false blank="Epuise"}}</select>
        </label>
        <label>
          <span>De d'usure max</span>
          <select name="system.deltaMax">{{selectOptions config.usageDieOptions selected=system.deltaMax localize=false}}</select>
        </label>
        <label class="span-two">
          <span>Effet</span>
          <input type="text" name="system.effet" value="{{system.effet}}">
        </label>
      {{/if}}

      {{#if isSpell}}
        <label>
          <span>Caracteristique</span>
          <select name="system.caracteristique">{{selectOptions config.characteristicOptions selected=system.caracteristique localize=false}}</select>
        </label>
        <label>
          <span>Difficulte</span>
          <input type="number" name="system.difficulte" value="{{system.difficulte}}">
        </label>
        <label>
          <span>Cout en PV</span>
          <input type="number" name="system.coutPv" value="{{system.coutPv}}">
        </label>
        <label>
          <span>Portee</span>
          <input type="text" name="system.portee" value="{{system.portee}}">
        </label>
        <label>
          <span>Duree</span>
          <input type="text" name="system.duree" value="{{system.duree}}">
        </label>
        <label>
          <span>Degats</span>
          <input type="text" name="system.degats" value="{{system.degats}}">
        </label>
        <label class="span-two">
          <span>Effet</span>
          <input type="text" name="system.effet" value="{{system.effet}}">
        </label>
      {{/if}}

      {{#if isCapacity}}
        <label>
          <span>Dé d'usure</span>
          <select name="system.delta">{{selectOptions config.usageDieOptions selected=system.delta localize=false}}</select>
        </label>
        <label class="span-two">
          <span>Effet</span>
          <input type="text" name="system.effet" value="{{system.effet}}">
        </label>
      {{/if}}

      {{#if isLanguage}}
        <label class="span-two">
          <span>Niveau</span>
          <input type="text" name="system.niveau" value="{{system.niveau}}">
        </label>
      {{/if}}

      {{#if isTrait}}
        <label class="span-two">
          <span>Etiquette</span>
          <input type="text" name="system.etiquette" value="{{system.etiquette}}">
        </label>
      {{/if}}
    </div>
  </header>

  <section class="sheet-card">
    <h2>Description</h2>
    <textarea name="system.description" rows="8" aria-label="Description">{{system.description}}</textarea>
  </section>

  <section class="sheet-card">
    <h2>Notes</h2>
    <textarea name="system.notes" rows="6" aria-label="Notes">{{system.notes}}</textarea>
  </section>

  <footer class="sheet-footer">
    <button type="button" data-action="postItem" aria-label="Poster dans le chat"><i class="fa-solid fa-message"></i> Poster dans le chat</button>
    <button type="button" data-action="rollItem" aria-label="Utiliser ou lancer l'objet"><i class="fa-solid fa-dice-d20"></i> Utiliser / lancer</button>
    {{#if canResetUsage}}
      <button type="button" data-action="resetUsageItem" aria-label="Reinitialiser l'usage"><i class="fa-solid fa-arrow-rotate-left"></i> Reinitialiser</button>
    {{/if}}
    {{#if canRollDamage}}
      <button type="button" data-action="rollDamageItem" aria-label="Lancer les degats"><i class="fa-solid fa-burst"></i> Lancer les degats</button>
    {{/if}}
  </footer>
</div>
