@using System.Collections.ObjectModel
@using System.Threading
@using System.Web.Http.Description

@{ Collection<ApiParameterDescription> parameters = Model.ApiDescription.ParameterDescriptions; }
@if (parameters.Count > 0)
{
    <table class="help-page-table">
        <thead>
        <tr><th>Name</th><th>Description</th><th>Additional information</th></tr>
        </thead>
        <tbody>
        @{
            foreach (ApiParameterDescription parameter in parameters)
            {
                var parameterDocumentation = parameter.Documentation ?? "No documentation available.";

                // Don't show CancellationToken because it's a special parameter
                if (!typeof (CancellationToken).IsAssignableFrom(parameter.ParameterDescriptor.ParameterType))
                {
                    <tr>
                        <td class="parameter-name">@parameter.Name</td>
                        <td class="parameter-documentation">
                            <p>@parameterDocumentation</p>
                        </td>
                        <td class="parameter-type">
                        @{
                            switch (parameter.Source)
                            {
                                case ApiParameterSource.FromBody:
                                    <p>Define this parameter in the request <b>body</b>.
                                    </p>
                                    break;
                                case ApiParameterSource.FromUri:
                                    <p>Define this parameter in the request <b>URI</b>.
                                    </p>
                                    break;
                                case ApiParameterSource.Unknown:
                                default:
                                    <p>None.</p>
                                    break;
                            }
                        }
                        </td>
                    </tr>
                }
            }
        }
        </tbody>
    </table>
}
else
{
    <p>None.</p>
}