#!/bin/bash

# Créer les templates manquants avec une structure de base

# Prouesse
cat > item-prouesse-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Catégorie</label><input type="text" name="system.categorie" value="{{system.categorie}}"/></li>
            <li class="flexrow"><label>Niveau</label><input type="number" name="system.niveau" value="{{system.niveau}}"/></li>
            <li class="flexrow"><label>Armes</label><input type="text" name="system.armes" value="{{system.armes}}"/></li>
            <li class="flexrow"><label>Prérequis</label><input type="text" name="system.prerequis" value="{{system.prerequis}}"/></li>
            <li class="flexrow"><label>Modificateur</label><input type="number" name="system.modificateur" value="{{system.modificateur}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Rune
cat > item-rune-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Niveau</label><input type="number" name="system.niveau" value="{{system.niveau}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Sortsejdr
cat > item-sortsejdr-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Forme</label><input type="text" name="system.forme" value="{{system.forme}}"/></li>
            <li class="flexrow"><label>Préparation</label><input type="text" name="system.preparation" value="{{system.preparation}}"/></li>
            <li class="flexrow"><label>Niveau</label><input type="number" name="system.niveau" value="{{system.niveau}}"/></li>
            <li class="flexrow"><label>Malus</label><input type="number" name="system.malus" value="{{system.malus}}"/></li>
            <li class="flexrow"><label>Durée</label><input type="text" name="system.duree" value="{{system.duree}}"/></li>
            <li class="flexrow"><label>Zone</label><input type="text" name="system.zone" value="{{system.zone}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Sortgaldr
cat > item-sortgaldr-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Voie</label><input type="text" name="system.voie" value="{{system.voie}}"/></li>
            <li class="flexrow"><label>Seuil de Difficulté</label><input type="number" name="system.sd" value="{{system.sd}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# ArmeCC
cat > item-armecc-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Catégorie</label><input type="text" name="system.categorie" value="{{system.categorie}}"/></li>
            <li class="flexrow"><label>Equipé</label><input type="checkbox" name="system.equipe" {{checked system.equipe}}/></li>
            <li class="flexrow"><label>Dégâts</label><input type="number" name="system.degat" value="{{system.degat}}"/></li>
            <li class="flexrow"><label>Solidité</label><input type="number" name="system.solidite" value="{{system.solidite}}"/></li>
            <li class="flexrow"><label>Encombrement</label><input type="number" name="system.enc" value="{{system.enc}}"/></li>
            <li class="flexrow"><label>Valeur</label><input type="number" name="system.valeur" value="{{system.valeur}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# ArmedDist
cat > item-armedist-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Catégorie</label><input type="text" name="system.categorie" value="{{system.categorie}}"/></li>
            <li class="flexrow"><label>Equipé</label><input type="checkbox" name="system.equipe" {{checked system.equipe}}/></li>
            <li class="flexrow"><label>Dégâts</label><input type="number" name="system.degat" value="{{system.degat}}"/></li>
            <li class="flexrow"><label>Solidité</label><input type="number" name="system.solidite" value="{{system.solidite}}"/></li>
            <li class="flexrow"><label>Portée</label><input type="text" name="system.portee" value="{{system.portee}}"/></li>
            <li class="flexrow"><label>Encombrement</label><input type="number" name="system.enc" value="{{system.enc}}"/></li>
            <li class="flexrow"><label>Valeur</label><input type="number" name="system.valeur" value="{{system.valeur}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Armure
cat > item-armure-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Catégorie</label><input type="text" name="system.categorie" value="{{system.categorie}}"/></li>
            <li class="flexrow"><label>Equipé</label><input type="checkbox" name="system.equipe" {{checked system.equipe}}/></li>
            <li class="flexrow"><label>Protection</label><input type="text" name="system.protection" value="{{system.protection}}"/></li>
            <li class="flexrow"><label>Encombrement</label><input type="number" name="system.enc" value="{{system.enc}}"/></li>
            <li class="flexrow"><label>Valeur</label><input type="number" name="system.valeur" value="{{system.valeur}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Bouclier
cat > item-bouclier-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Catégorie</label><input type="text" name="system.categorie" value="{{system.categorie}}"/></li>
            <li class="flexrow"><label>Equipé</label><input type="checkbox" name="system.equipe" {{checked system.equipe}}/></li>
            <li class="flexrow"><label>Bonus Défense</label><input type="number" name="system.defensebonus" value="{{system.defensebonus}}"/></li>
            <li class="flexrow"><label>Encombrement</label><input type="number" name="system.enc" value="{{system.enc}}"/></li>
            <li class="flexrow"><label>Enc. Combat</label><input type="number" name="system.enccomb" value="{{system.enccomb}}"/></li>
            <li class="flexrow"><label>Solidité</label><input type="number" name="system.solidite" value="{{system.solidite}}"/></li>
            <li class="flexrow"><label>Valeur</label><input type="number" name="system.valeur" value="{{system.valeur}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Equipement
cat > item-equipement-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Equipé</label><input type="checkbox" name="system.equipe" {{checked system.equipe}}/></li>
            <li class="flexrow"><label>Quantité</label><input type="number" name="system.quantite" value="{{system.quantite}}"/></li>
            <li class="flexrow"><label>Encombrement</label><input type="number" name="system.enc" value="{{system.enc}}"/></li>
            <li class="flexrow"><label>Valeur</label><input type="number" name="system.valeur" value="{{system.valeur}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Monnaie
cat > item-monnaie-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Quantité</label><input type="number" name="system.quantite" value="{{system.quantite}}"/></li>
            <li class="flexrow"><label>Encombrement</label><input type="number" name="system.enc" value="{{system.enc}}"/></li>
          </ul>
          <label>Description</label>
          <div class="editor-content">{{{enrichedDescription}}}</div>
        </div>
    </section>
</section>
EOF

# Effetmagique
cat > item-effetmagique-sheet.hbs << 'EOF'
<section class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img class="profile-img" src="{{item.img}}" data-action="editImage" title="{{item.name}}"/>
        <div class="header-fields">
            <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Nom"/></h1>
        </div>
    </header>
    <section class="sheet-body">
        <div class="tab">
          <ul>
            <li class="flexrow"><label>Origine</label><input type="text" name="system.origine" value="{{system.origine}}"/></li>
          </ul>
          <label>Effet</label>
          <div class="editor-content">
            {{#if system.effet}}
              {{{system.effet}}}
            {{else}}
              <p>Aucun effet défini</p>
            {{/if}}
          </div>
        </div>
    </section>
</section>
EOF

echo "Created all item templates!"
ls -1 item-*-sheet.hbs | wc -l
