<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">

  <div class='configurator'>
    <div id="${it.implementedAPI.simpleName}-${it.name}" class='configurator__name'>${it.name}
      <sup class="${it.rootElement ? 'root-configurator-pointer' : 'configurator-pointer'}">
        <j:choose>
          <j:when test="${it.rootElement}">
            ⚙️ ️${%ROOT ELEMENT}
          </j:when>
          <j:otherwise>
            ${%CONFIGURATOR}
          </j:otherwise>
        </j:choose>

      </sup>
    </div>

    <j:if test="${it.implementedAPI != it.target}">
        <div class='configurator__implementation'>
            Implementation of
            <a href="https://jenkins.io/doc/developer/extensions/${casc.getExtensionSource(it)}/#${it.implementedAPI.simpleName.toLowerCase()}">
                ${it.implementedAPI.simpleName}
            </a>
        </div>
    </j:if>

    <j:if test="${it.name != it.displayName}">
      <div class='configurator__display-name'>${it.displayName}</div>
    </j:if>
    
    <div class='configurator-attributes'>
    <j:forEach items="${it.attributes}" var="a">
        <div class='configurator-attribute'>
            <div class='configurator-attribute__name'><span class='attribute-name'>${a.name}</span></div>
            <div class='configurator-attribute__details'>
                <div class='attribute-type'>
                  <j:if test="${a.multiple}"><span class='attribute-type__list'>list of</span></j:if>
                  <span class='attribute-type__class'>${a.type.simpleName}</span>
                </div>
                <div class='attribute-help'>
                    <j:out value="${casc.getHtmlHelp(it.target, a.name)}"/>
                              <!-- FIXME .html is not a standard facet, stapler only looks for groovy/jelly
                              <st:include page="help-${a.name}.html" class="${it.target}" optional="true"/>
                              -->
                </div>

                <j:if test="${not a.possibleValues().isEmpty()}">
                <div class='attribute-values'>
                    <div class='attribute-values__title'>${%Possible values:}</div>
                    <ul class='attribute-values__list'>
                      <j:forEach items="${a.possibleValues()}" var="v">
                        <li><a href="#${a.type.simpleName}-${v}">${v}</a></li>
                      </j:forEach>
                    </ul>
                </div>
                </j:if>

            </div>
        </div>
        </j:forEach>
    </div>
  </div>

</j:jelly>
