{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: MPL-2.0
}}

<div
  class="resolver-card"
>
  <header
    ...attributes
    onclick={{optional @onclick}} id={{concat 'resolver:' @item.ID}}>
    <a name="">
      <h3>{{@item.Name}}</h3>
{{#if @item.Failover}}
      <dl class="failover">
        <dt
          {{tooltip (concat @item.Failover.Type ' failover')}}
        >
          {{concat @item.Failover.Type ' failover'}}
        </dt>
        <dd>
          <ol>
  {{#each @item.Failover.Targets as |item|}}
            <li><span>{{item}}</span></li>
  {{/each}}
          </ol>
        </dd>
      </dl>
{{/if}}
    </a>
  </header>
{{#if (gt @item.Children.length 0)}}
    <ul>
  {{#each @item.Children as |child|}}
      <li
        onclick={{optional @onclick}}
        id={{concat 'resolver:' child.ID}}
        {{on-resize (dom-position (set child 'rect') from=@edges)}}
      >
        <a name="">
    {{#if child.Redirect}}
          <dl class="redirect">
            <dt
              {{tooltip (concat child.Redirect ' redirect')}}
            >
              {{child.Redirect}} redirect
            </dt>
            <dd>
              {{child.Name}}
            </dd>
          </dl>
          {{#if child.Failover}}
            <dl class="failover">
              <dt
                {{tooltip (concat child.Failover.Type ' failover')}}
              >
                {{child.Failover.Type}} failover
              </dt>
              <dd>
                <ol>
        {{#each child.Failover.Targets as |target|}}
                  <li>
                    <span>{{target}}</span>
                  </li>
        {{/each}}
                </ol>
              </dd>
            </dl>
          {{/if}}
    {{else if child.Failover}}
          {{child.Name}}
          <dl class="failover">
            <dt
              {{tooltip (concat child.Failover.Type ' failover')}}
            >
              {{concat child.Failover.Type ' failover'}}
            </dt>
            <dd>
              <ol>
      {{#each child.Failover.Targets as |target|}}
                <li>
                  <span>{{target}}</span>
                </li>
      {{/each}}
              </ol>
            </dd>
          </dl>
    {{else}}
          {{child.Name}}
    {{/if}}
        </a>
      </li>
  {{/each}}
    </ul>
{{/if}}
</div>
