@using System.Collections.Generic
@using System.Net.Http.Headers
@using DalSoft.WebApi.HelpPage.Models

@model HelpPageApiModel

@{
    var description = Model.ApiDescription;
    var hasParameters = description.ParameterDescriptions.Count > 0;
    var hasRequestSamples = Model.SampleRequests.Count > 0;
    var hasResponseSamples = Model.SampleResponses.Count > 0;
}
<h1>@description.HttpMethod.Method @description.RelativePath</h1>
<div>
    @{
        if (description.Documentation != null)
        {
            <p>@description.Documentation</p>
        }
        else
        {
            <p>No documentation available.</p>
        }

        if (hasParameters || hasRequestSamples)
        {
            <h2>Request Information</h2>
            if (hasParameters)
            {
                <h3>Parameters</h3>
                @Include("Parameters.cshtml", Model, typeof(HelpPageApiModel))
            }
            if (hasRequestSamples)
            {
                <h3>Request body formats</h3>
                var ModelSamples = Model.SampleRequests;
                @Include("Samples.cshtml", ModelSamples, typeof(IDictionary<MediaTypeHeaderValue, object>))
            }
        }

        if (hasResponseSamples)
        {
            <h2>Response Information</h2>
            <h3>Response body formats</h3>
            var ModelSamples = Model.SampleResponses;
		    @Include("Samples.cshtml", ModelSamples, typeof(IDictionary<MediaTypeHeaderValue, object>))
        }
}
</div>