{{!--
Inventory/Domain Card Section

{{> 'daggerheart.inventory-items' }}

Parameters:
- title {string} : Localization key used for the legend.
- collection {array} : Array of items to render.
- type {string} : The type of items in the list:
- isGlassy {boolean} : If true, applies the 'glassy' class to the fieldset.
- cardView {boolean} : If true and type is 'domainCard', renders using domain card layout.
- isActor {boolean} : Passed through to inventory-item partials.
- isItem {boolean} : Passed through to inventory-item partials
- actorType {boolean} : The actor type of the parent actor
- canCreate {boolean} : If true, show createDoc anchor on legend
- inVault {boolean} : If true, the domainCard is created with inVault=true
- disabled {boolean}:  If true, the ActiveEffect is created with disabled=true;
- categoryAdversary {string} : Category adversary id.
- showLabels {boolean} : If true, show label-tags else show simple tags.
- hideTooltip {boolean} : If true, disables the tooltip on the item image.
- hideControls {boolean} : If true, hides the controls inside inventory-item partials.
- hideDescription {boolean} : If true, hides the item's description.
- hideResources {boolean} : If true, hides the item's resources.
- showActions {boolean} : If true show feature's actions. 
--}}

<fieldset class="{{#if isGlassy}}glassy{{/if}} drop-section">
  <legend>
    {{localize title}}
    {{#if canCreate}}
    <a data-action="{{ifThen (or (eq type 'effect') (eq type 'feature') (eq type 'action')) 'createDoc' 'addNewItem' }}" data-document-class="{{ifThen (eq type 'effect') 'ActiveEffect' 'Item' }}"
      data-type="{{ifThen (eq type 'effect') 'base' type}}"
      {{#if inVault}}data-in-vault="{{inVault}}"{{/if}}
      {{#if disabled}} data-disabled="{{disabled}}"{{/if}}
      data-tooltip="{{localize 'DOCUMENT.Create' type=''}}"
      >
      <i class="fa-solid fa-plus icon-button"></i>
    </a>
    {{/if }}
  </legend>
  {{#if (and cardView (eq type 'domainCard'))}}
  <ul class="card-list">
    {{#each collection as |item|}}

    {{> 'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs'
    item=item
    type='domainCard'
    }}

    {{/each}}
  </ul>
  {{else}}
  <ul class="items-list">
    {{#each collection as |item|}}

    {{> 'daggerheart.inventory-item'
    item=item
    type=../type
    actorType=../actorType
    hideControls=../hideControls
    hideContextMenu=../hideContextMenu
    isActor=../isActor
    categoryAdversary=../categoryAdversary
    hideTooltip=../hideTooltip
    showLabels=../showLabels
    isAction=../isAction
    hideResources=../hideResources
    showActions=../showActions
    }}

    {{/each}}
  </ul>
  {{/if}}
</fieldset>