{{!--
    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="sw-responses">
        {{#if produces}}
            <p>{{>swagger/list-of-labels values=produces}}</p>
        {{else if @root.produces}}
            <p><a href="#sw-default-produces">Uses default content-types: </a>
                {{>swagger/list-of-labels values=@root.produces}}
            </p>
        {{/if}}

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