<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<span ng-switch="mode">

  <span ng-switch-when="target">
    <span ng-if="dsl.getRoot().relationships.length === 0" class="label label-primary">
        <span ng-if="!dsl.params[0] || !dsl.params[0].name || (dsl.name!='component' && dsl.name!='entity')">
            {{dsl.name}}
        </span>
        {{dsl.params[0].name}}
    </span>
    <a ng-if="dsl.getRoot().relationships.length > 0" ui-sref="main.graphical.edit.entity({entityId: relatedEntity._id})"><span class="label label-primary">{{relatedEntity ? (relatedEntity | entityName) || 'Application' : dsl.name}}</span></a>
    <span ng-if="dsl.next">
        ⇒
        <dsl-viewer dsl="dsl.next"></dsl-viewer>
    </span>
  </span>
  
  <span ng-switch-when="method">
    <span class="label label-default">
        <i class="fa" ng-class="icon"></i>
        {{dsl.name}}
    </span>
    
    <span ng-if="dsl.params.length == 1">
        →
        <dsl-viewer dsl="dsl.params[0]"></dsl-viewer>
    </span>
    <ul ng-if="dsl.params.length > 1">
        <li ng-repeat="argument in dsl.params | limitTo:dsl.params.length">
            <dsl-viewer dsl="argument"></dsl-viewer>
        </li>
    </ul>
    
    <span ng-if="dsl.next">
        ⇒
        <dsl-viewer dsl="dsl.next"></dsl-viewer>
    </span>
  </span>
  
  <span ng-switch-when="utility">
    <span class="label label-info">
        <i class="fa" ng-class="icon"></i>
        {{dsl.name}}
    </span>
    
    <span ng-if="dsl.params.length >= 1">
        →
        <dsl-viewer dsl="dsl.params[0]"></dsl-viewer>
    </span>
    <ul ng-if="dsl.params.length > 1">
        <li ng-repeat="argument in dsl.params | limitTo:dsl.params.length:1">
            <dsl-viewer dsl="argument"></dsl-viewer>
        </li>
    </ul>
  </span>

  <span ng-switch-when="constant">
    <span class="dsl-constant">
        <samp>{{dsl.name}}</samp>
    </span>
  </span>

  <span ng-switch-when="reference">
    <span class="label label-primary">
        {{dsl.name}}
    </span>
  </span>

  <span ng-switch-default>
    {{ !mode || mode==='unknown' ? '' : mode }}: {{ dsl.name }}
  </span>
  
</span>
