{{!--
    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 produced by the operation
    @api public
--}}

{{#if responses}}
    <section class="swagger-responses">
        {{#if produces}}
            <p>{{>swagger/list-of-labels values=produces}}</p>
        {{else if @root.produces}}
            <p><a href="#swagger-default-produces">Uses default content-types: </a>
                {{>swagger/list-of-labels values=@root.produces}}
            </p>
        {{/if}}

        <dl>
            {{#each responses}}
                <dt class="swagger-response-{{@key}}">
                    {{! Use response-code and http-name as text}}
                    {{@key}} {{httpResponseCode @key}}
                    {{#if $ref}}
                        <span class="swagger-global"></span> <span class="json-schema-reference"><a href="{{$ref}}">{{$ref}}</a></span>
                    {{/if}}
                </dt>
                <dd class="swagger-response-{{@key}}">
                    {{#if $ref}}
                        {{>swagger/response response=(json-schema-resolve-ref $ref)}}
                    {{else}}
                        {{>swagger/response response=.}}
                    {{/if}}
                </dd>
            {{/each}}
        </dl>
    </section>
{{/if}}
