<%--
/*
* 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.
*/
--%>
#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._)
<%@ val sameNameFunctionDetails: SameNameFunctionDetails %>
<%@ val withCaption: Boolean%>
<div class="row">
    <div class="col-md-2"></div>
    <div class="col-md-8 col-offset-md-2">
        #for (function <- sameNameFunctionDetails.functions)    
        <div class="panel panel-default table-responsive table-bordered">
            <table class="table">
                #if(withCaption)
                <caption><h4 class="text-success"><span class="glyphicon glyphicon-random"></span>&nbsp;${function.name}</h4></caption>
                #end
                <tbody>
                    <tr>
                        <td class="col-md-6"><strong>Keyspace</strong></td>
                        <td class="col-md-6 text-danger" style="text-align:left">${function.keyspace}</td>
                    </tr>
                    <tr>
                        <td class="col-md-6"><strong>Arguments</strong></td>
                        <td class="col-md-6" style="text-align:left">${function.arguments.toList.mkString(", ")}</td>
                    </tr>
                    <tr>
                        <td class="col-md-6"><strong>Null Input</strong></td>
                        #if(function.calledOnNullInput)
                        <td class="col-md-6" style="text-align:left">CALLED ON NULL INPUT</td>
                        #else
                        <td class="col-md-6" style="text-align:left">RETURN NULL ON NULL INPUT</td>
                        #end
                    </tr>                    
                    <tr>
                        <td class="col-md-6"><strong>Return type</strong></td>
                        <td class="col-md-6" style="text-align:left">${function.returnType}</td>
                    </tr>                    
                    <tr>
                        <td class="col-md-6"><strong>Language</strong></td>
                        <td class="col-md-6" style="text-align:left">${function.language}</td>
                    </tr>                    
                    <tr>
                        <td class="col-md-6"><strong>Body</strong></td>
                        <td class="col-md-6" style="text-align:left">${escape(function.body)}</td>
                    </tr>                    
                </tbody>
            </table>
            <div class="panel-footer">
                <a data-toggle="collapse" data-target="#${function.uniqueId}_asCQL">
                    <strong>As CQL statement</strong>
                    <span class="caret"></span>
                </a>
                <br/><br/>
                <div class="text-success collapse" id="${function.uniqueId}_asCQL">
                    <pre class="well">${function.asCQL}</pre>
                </div>
            </div>
        </div>
        <hr/>
        #end
    </div>
    <div class="col-md-2"></div>
</div>