<#function stabilityEmoji obj>
  <#if obj.stability??>
    <#switch obj.stability>
      <#case "experimental">
        <#return "<abbr title=\"Experimental feature\">&#x1F174;</abbr>">
      <#case "preview">
        <#return "<abbr title=\"Preview feature\">&#x1F17F;</abbr>">
      <#case "community">
        <#return "<abbr title=\"Community feature\">&#x1F172;</abbr>">
    </#switch>
  </#if>
  <#return "">
</#function>

<ol class="breadcrumb">
<#list breadcrumbs as crumb>
        <#if crumb_has_next>
            <li class="breadcrumb-item">
                <a href="${relativePathToContextRoot}${crumb.url}">${crumb.label}</a>
            </li>
            <#else>
                <li class="breadcrumb-item active">${crumb.label}</li>
        </#if>
    </#list>
</ol>

<#if model.deprecated.deprecated>
    <div class="alert alert-danger">
        <strong>Deprecated</strong> Since ${model.deprecated.since}
        <div>${model.deprecated.reason}</div>
    </div>
</#if>

<div class="well">
    <p>${stabilityEmoji(model)} ${model.description}</p>
</div>

<#if has_messages>

<div class="page-header">
    <p><a href="${relativePathToContextRoot}log-message-reference.html">Log and Exception Message Code Reference</a></p>
</div>

</#if>

<#if model.runtime>
    <div class="alert alert-info" role="alert">
        <strong>Runtime only resource</strong> This resource is runtime only and doesn't have any persistent configuration.
    </div>
</#if>

<#if model.children?size != 0>
<div class="page-header">

    <h4 class="btn btn-secondary" data-toggle="collapse" data-target="#children">Children (${model.children?size})</h4>

    <div class="collapse show" id="children">
        <ul>
            <#list model.children as child>
                <li>

                    <#if child.children?size == 0>
                        <#noautoesc>
                        <a href="${child.name}/index.html" class="${child.deprecated.deprecated?then('deprecated','')}">${stabilityEmoji(child)} ${child.name}</a>
                        </#noautoesc>
                        <#else>
                            <b>${child.name}</b>
                    </#if>
                    ${child.description}
                </li>
                <#if child.children?size != 0>
                    <ul>
                        <#list child.children as c>
                            <li>
                                <#noautoesc>
                                <a href="${child.name}/${c.name}/index.html" class="${c.deprecated.deprecated?then('deprecated','')}">${c.name}</a>
                                </#noautoesc>
                                ${c.description}
                            </li>
                        </#list>
                    </ul>
                </#if>
            </#list>
        </ul>
    </div>
</div>
</#if>
<#if model.capabilities?size != 0>
    <div class="page-header">

        <h4 class="btn btn-secondary" data-toggle="collapse" data-target="#capabilities">Provided capabilities(${model.capabilities?size})</h4>
        <div class="collapse show table-responsive capabilities" id="capabilities">
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>Name</th>
                    <th>Dynamic</th>
                    <th>Other provider points</th>
                </tr>
                </thead>
                <tbody>
                <#list model.capabilities as cap>
                    <tr>
                        <td><a href="${cap.capabilityDescriptionUrl}">${cap.name}</a></td>
                        <td>${cap.dynamic?c}</td>
                        <td>
                            <#if cap.providerPointsUrls?has_content >
                            <#list cap.providerPointsUrls as capName,capUrl>
                                <a href="${relativePathToContextRoot}${capUrl}index.html">${capName}</a> <br/>
                            </#list>
                                <#else><p>none</p>
                            </#if>
                        </td>
                    </tr>
                </#list>
                </tbody>
            </table>
        </div>
    </div>
</#if>

<#if model.attributes?size != 0>

    <div class="page-header">

        <h4 class="btn btn-secondary" data-toggle="collapse" data-target="#attributes">Attributes
            (${model.attributes?size})</h4>
        <div class="collapse show" id="attributes">
            <div class="panel">
                <ul>
                    <#list model.attributes as attribute>
                        <li>
                            <a id="attr-${attribute.name}" href="#attr-${attribute.name}" data-toggle="collapse" data-target="#attribute-${attribute.name}" class="${attribute.deprecated.deprecated?then('deprecated','')}">${stabilityEmoji(attribute)} ${attribute.name}</a>
                            ${attribute.description}
                        </li>

                        <div id="attribute-${attribute.name}" class="collapse">
                            <#if attribute.deprecated.deprecated>
                                <div class="alert alert-danger">
                                    <strong>Deprecated</strong> Since ${attribute.deprecated.since}
                                    <div>${attribute.deprecated.reason}</div>
                                </div>
                            </#if>
                            <div class="table-responsive">
                            <table class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th>Attribute</th>
                                    <th>Value</th>
                                </tr>
                                </thead>
                                <#if attribute.defaultValue??>
                                    <tr>
                                        <td>
                                            <b>Default Value</b>
                                        </td>
                                        <td>
                                            ${attribute.defaultValue}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.capabilityReference??>
                                    <tr>
                                        <td>
                                            <b>Capability reference</b>
                                        </td>
                                        <td>
                                            <#if globalCapabilities[attribute.capabilityReference]??>
                                            <button tabindex="0" type="button" class="btn btn-link" data-toggle="popover-provider-points" data-target="#popover-${attribute.name}-body" data-trigger="focus" title="Provider points" >${attribute.capabilityReference}</button>
                                            <div class="invisible" id="popover-${attribute.name}-body" style="display:none">
                                                <#assign cap = globalCapabilities[attribute.capabilityReference] />
                                                <#if cap??>
                                                    <#list cap.providerPointsUrls as capName,capUrl>
                                                        <a href="${relativePathToContextRoot}${capUrl}index.html">${capName}</a> <br/>
                                                    </#list>
                                                </#if>
                                            </div>
                                                <#else>
                                                    ${attribute.capabilityReference}
                                            </#if>

                                        </td>
                                    </tr>
                                </#if>
                                <tr>
                                    <td>
                                        <b>Type</b>
                                    </td>
                                    <td>
                                        ${attribute.type}
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>Nillable</b>
                                    </td>
                                    <td>
                                        ${attribute.nillable?c}
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>Expressions Allowed</b>
                                    </td>
                                    <td>
                                        ${attribute.expressionsAllowed?c}
                                    </td>
                                </tr>
                                <#if attribute.min??>
                                    <tr>
                                        <td>
                                            <b>Min</b>
                                        </td>
                                        <td>
                                            ${attribute.min}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.max??>
                                    <tr>
                                        <td>
                                            <b>Max</b>
                                        </td>
                                        <td>
                                            ${attribute.max}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.unit??>
                                    <tr>
                                        <td>
                                            <b>Unit</b>
                                        </td>
                                        <td>
                                            ${attribute.unit}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.storage??>
                                    <tr>
                                        <td>
                                            <b>Storage</b>
                                        </td>
                                        <td>
                                            ${attribute.storage}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.accessType??>
                                    <tr>
                                        <td>
                                            <b>Access Type</b>
                                        </td>
                                        <td>
                                            ${attribute.accessType}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.restartRequired??>
                                    <tr>
                                        <td>
                                            <b>Restart Required</b>
                                        </td>
                                        <td>
                                            ${attribute.restartRequired}
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.allowedValues?size != 0>
                                    <tr>
                                        <td>
                                            <b>Allowed Values</b>
                                        </td>
                                        <td>
                                            <#list attribute.allowedValues as allowedValue>
                                                ${allowedValue}<br/>
                                            </#list>
                                        </td>
                                    </tr>
                                </#if>
                                <#if attribute.stability??>
                                <tr>
                                    <td>
                                        <b>Stability</b>
                                    </td>
                                    <td>
                                        ${attribute.stability}
                                    </td>
                                </tr>
                            </#if>

                            </table>
                            </div>
                        </div>
                    </#list>
                </ul>
            </div>
        </div>
    </div>

</#if>

<#if model.operations?size != 0>

    <div class="page-header">

        <h4 class="btn btn-secondary" data-toggle="collapse" data-target="#operations">Operations
            (${model.operations?size})</h4>

        <div class="collapse show" id="operations">
            <ul>
                <#list model.operations as op>
                    <li>
                        <a id="op-${op.name}" href="#op-${op.name}" data-toggle="collapse" data-target="#operation-${op.name}" class="${(op.deprecated.deprecated)?then('deprecated','')}">${stabilityEmoji(op)} ${op.name}</a>
                        ${op.description}

                        <div id="operation-${op.name}" class="collapse">
                            <#if op.deprecated.deprecated>
                                <div class="alert alert-danger">
                                    <strong>Deprecated</strong> Since ${op.deprecated.since}
                                    <div>${op.deprecated.reason}</div>
                                </div>
                            </#if>
                                <#if op.parameters?size != 0>
                                    <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>Request Parameter</th>
                                            <th>Type</th>
                                            <th>Required</th>
                                            <th>Expressions Allowed</th>
                                            <th>Default value</th>
                                            <th>Description</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <#list op.parameters as param>
                                        <tr>
                                            <td>${param.name}</td>
                                            <td>${param.type}</td>
                                            <td>${param.required?c}</td>
                                            <td>${param.expressionsAllowed?c}</td>
                                            <td>${param.defaultValue!''}</td>
                                            <td>${param.description}</td>
                                        </tr>
                                    </#list>
                                    </tbody>
                                    </table>
                                </#if>
                            <#if op.reply??>
                                <div class="panel panel-primary">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">Reply properties</h4>
                                    </div>
                                    <div class="panel-body">
                                        ${op.reply.description}
                                        <dl>
                                            <dt>type</dt>
                                            <dd>${op.reply.type}</dd>
                                            <#if op.reply.valueType??>
                                                <dt>Value Type</dt>
                                                <dd><div class="highlight">
                                                    <pre><code class="language-json" data-lang="json">${op.reply.valueType}</code></pre>
                                                </div>
                                                </dd>
                                            </#if>
                                        </dl>
                                    </div>
                                </div>
                            </#if>
                        </div>
                    </li>
                </#list>
            </ul>
        </div>
    </div>

</#if>


