{{!--
    Renders the responses section of an operation
    @param {Response[]} responses a list of Swagger-Response definitions
    @param {string[]} produces a list of response content types produces by the operation
    @api public
--}}

{{#if responses}}
    <div class="response">
        <h5>Response</h5>

        <table>
            {{#each responses}}
                <tr>
                    <td class="code">{{code}} {{#hasExamples .}}<a href="#" class="example-trigger">Examples</a>{{/hasExamples}}</td>
                    <td class="resp">{{{md description}}}</td>
                    <td class="desc">{{#if defaultContent}}{{#if defaultContent.schema}}{{>model/datatype defaultContent anchor='/schemas'}}{{else}}<em>Undocumented</em>{{/if}}{{/if}}</td>
                </tr>
                {{#hasExamples .}}
                    <tr class="examples">
                        <td colspan="3">
                            {{#each contents}}
                            {{#each examples}}
                                <div class="example">
                                    {{#if name}}
                                        <p><strong>{{name}}</strong></p>
                                    {{/if}}
<pre>
{{valuePretty}}
</pre>
                                    {{#if mediaType}}
                                        <p><span class="type">{{mediaType.mediaType}}</span></p>
                                    {{/if}}
                                </div>
                            {{/each}}
                            {{/each}}
                        </td>
                    </tr>
                {{/hasExamples}}
            {{/each}}
        </table>

        {{#if produces}}
        <p>{{#each produces}}<span class="type">{{mediaType}}</span> {{/each}}</p>
        {{/if}}

        {{#each responses}}
        {{#if defaultContent.schema.anonymous}}
        {{>api/model model=defaultContent.schema anchor="/schemas"}}
        {{/if}}
        {{/each}}
    </div>
{{/if}}