<div class="page-header">
  <h1>
    {{ swagger.info.title }}
  </h1>
</div>

<div ng-repeat="tag in swagger.tags">
  <h3>{{ tag.summary }}</h3>
  <div marked="tag.description"></div>
  <accordion close-others="false">
    <accordion-group ng-repeat="operation in operations[tag.name]"
                     is-open="operation_open">
      <accordion-heading>
        <div class="operation-header">
          <i class="pull-right glyphicon"
             ng-class="{'glyphicon-menu-down': operation_open, 'glyphicon-menu-right': !operation_open}">
          </i>
          <div class="operation-method">
            <swagger-method method="operation.method"></swagger-method>
          </div>
          <div class="operation-title">
            {{ operation.title }}
            <br/>
            <small>{{ operation.summary }}</small>
          </div>
        </div>
      </accordion-heading>
      <div class="row">
        <div class="col-md-12">
          <h4>
            <swagger-path path="operation.path"
                          parameters="operation.parameters">
            </swagger-path>
          </h4>
        </div>
      </div>
      <div class="row">
        <div ng-controller="ParametersCtrl" class="col-lg-6">
          <tabset>
            <tab heading="Description">
              <div class="content" ng-if="!isEmpty(operation.description)"
                   marked="operation.description">
              </div>
              <ng-include ng-if="isEmpty(operation.description)"
                          src="'browser/undocumented-operation.html'">
              </ng-include>
            </tab>
            <tab heading="Details">
              <div ng-if="parameters.header">
                <h5>Headers</h5>
                <dl>
                  <dt ng-repeat-start="parameter in parameters.header">{{parameter.name}}
                  </dt>
                  <dd ng-repeat-end><span marked="parameter.description"/></dd>
                </dl>
              </div>
              <div ng-if="parameters.query">
                <h5>URL Parameters</h5>
                <dl>
                  <dt ng-repeat-start="parameter in parameters.query">{{parameter.name}}
                  </dt>
                  <dd ng-repeat-end><span marked="parameter.description"/></dd>
                </dl>
              </div>
              <div ng-if="parameters.body">
                <h5>Request Schema</h5>
                <swagger-schema swagger="swagger" parameters="parameters.body"></swagger-schema>
              </div>
            </tab>
          </tabset>
        </div>
        <div class="col-lg-6">
          <h4>Request</h4>
          <swagger-example ng-if="!isEmpty(operation.examples)"
                           swagger="swagger"
                           src="operation.examples"
                           trigger-load="operation_open">
          </swagger-example>
          <div ng-if="isEmpty(operation.examples)" class="well text-muted">
            No request recorded.
          </div>
          <h4>Responses</h4>
          <accordion close-others="true">
            <accordion-group ng-repeat="(status_code, response) in operation.responses"
                             is-disabled="isEmpty(response.examples)"
                             is-open="status.open">
              <accordion-heading>
                {{ status_code }}: {{ response.description }}
                <i ng-if="!isEmpty(response.examples)"
                   class="pull-right glyphicon"
                   ng-class="{'glyphicon-menu-down': status.open, 'glyphicon-menu-right': !status.open}"></i>
              </accordion-heading>
              <swagger-example swagger="swagger"
                               src="response.examples"
                               trigger-load="status.open">
              </swagger-example>
            </accordion-group>
          </accordion>
        </div>
      </div>
    </accordion-group>
  </accordion>
</div>
