{{#if (gt items.length 0)}}
<ListCollection @items={{items}} class="consul-lock-session-list" as |item index|>
  <BlockSlot @name="header">
  {{#if item.Name}}
    <span>{{item.Name}}</span>
  {{else}}
    <span>
      {{item.ID}}
      <CopyButton
        @value={{item.ID}}
        @name="ID"
      />
    </span>
  {{/if}}
  </BlockSlot>
  <BlockSlot @name="details">
    {{#if item.Name}}
    <dl>
      <dt>
        ID
      </dt>
      <dd>
        <CopyButton
          @value={{item.ID}}
          @name="ID"
        />
        {{item.ID}}
      </dd>
    </dl>
    {{/if}}
    <dl class="lock-delay">
      <dt {{tooltip}}>
        Delay
      </dt>
      <dd data-test-session-delay>{{duration-from item.LockDelay}}</dd>
    </dl>
    <dl class="ttl">
      <dt {{tooltip}}>
        TTL
      </dt>
    {{#if (eq item.TTL "")}}
      <dd data-test-session-ttl={{item.TTL}}>-</dd>
    {{else}}
      <dd data-test-session-ttl={{item.TTL}}>{{item.TTL}}</dd>
    {{/if}}
    </dl>
    <dl class="behavior">
      <dt {{tooltip}}>
        Behavior
      </dt>
      <dd>{{item.Behavior}}</dd>
    </dl>
{{#let (union item.NodeChecks item.ServiceChecks) as |checks|}}
    <dl class="checks">
      <dt {{tooltip}}>
        Checks
      </dt>
      <dd>
{{#if (gt checks.length 0)}}
      {{#each checks as |item|}}
        <span>{{item}}</span>
      {{/each}}
{{else}}
        -
{{/if}}
      </dd>
    </dl>
{{/let}}
  </BlockSlot>
  <BlockSlot @name="actions">
    <ConfirmationDialog @message="Are you sure you want to invalidate this session?">
      <BlockSlot @name="action" as |confirm|>
          <button data-test-delete
            type="button"
            class="type-delete"
            onclick={{action confirm onInvalidate item}}
          >
            Invalidate
          </button>
      </BlockSlot>
      <BlockSlot @name="dialog" as |execute cancel message|>
          <p>
              {{message}}
          </p>
          <button type="button" class="type-delete" onclick={{action execute}}>Confirm Invalidate</button>
          <button type="button" class="type-cancel" onclick={{action cancel}}>Cancel</button>
      </BlockSlot>
    </ConfirmationDialog>
  </BlockSlot>
</ListCollection>
{{/if}}