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

<div
  class="consul-intention-view"
  ...attributes
>

  <div class="definition-table">
      <dl>
        <dt>Destination</dt>
        <dd>
          <Consul::Bucket::List
            @item={{hash
              Namespace=item.DestinationNS
              Partition=item.DestinationPartition
              Service=item.DestinationName
            }}
            @nspace="-"
            @partition="-"
            @service={{true}}
          />
        </dd>
        <dt>Source</dt>
        <dd>
          <Consul::Bucket::List
            @item={{hash
              Namespace=item.SourceNS
              Partition=item.SourcePartition
              Service=item.SourceName
              PeerName=item.SourcePeer
            }}
            @nspace="-"
            @partition="-"
            @service={{true}}
          />
        </dd>
{{#if item.Action}}
        <dt>Action</dt>
        <dd>
          {{item.Action}}
        </dd>
{{/if}}
        <dt>Description</dt>
        <dd>
          {{or item.Description 'N/A'}}
        </dd>
      </dl>
  </div>

{{#if (gt item.Permissions.length 0) }}
  <h2>Permissions</h2>
  <Consul::Intention::Notice::Permissions />
  <Consul::Intention::Permission::List
    @items={{item.Permissions}}
  />
{{/if}}

</div>
