<?php
global $apiSettings;

include '../apiconfig.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>FSM Server API Documentation</title>
  <link rel="stylesheet" type="text/css" href="../../vendor/V2/vendor/swagger-api/swagger-ui/dist/swagger-ui.css" >
  <link rel="stylesheet" type="text/css" href="server_api.css" >
  <link rel="icon" type="image/png" href="../../vendor/V2/vendor/swagger-api/swagger-ui/dist/favicon-32x32.png" sizes="32x32" />
  <link rel="icon" type="image/png" href="../../vendor/V2/vendor/swagger-api/swagger-ui/dist/favicon-16x16.png" sizes="16x16" />
</head>

<body>
<div id="swagger-ui"></div>

<script src="../../vendor/V2/vendor/swagger-api/swagger-ui/dist/swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="../../vendor/V2/vendor/swagger-api/swagger-ui/dist/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="../../vendor/V2/vendor/swagger-api/swagger-ui/dist/swagger-initializer.js" charset="UTF-8"> </script>

<!--suppress JSUnresolvedFunction, JSUnresolvedVariable -->
<script>
  /**
   * @return {string}
   */
  function ExtractPrePath(sSubPath, sRequestUri)
  {
    const pos = sRequestUri.indexOf(sSubPath)
    return (pos >= 0 ? sRequestUri.substr(0, pos) : '');
  }

  window.onload = function() {
    // Begin Swagger UI call region
    const sPrePath = ExtractPrePath('dfmserver/doc', window.location.href).replace(/\/+$/,'');
    const sRedirectPath = sPrePath + '/vendor/V2/vendor/swagger-api/swagger-ui/dist/oauth2-redirect.html';
    const sYamlFile = sPrePath + '/dfmserver/doc/server_api.yaml';
    window.ui = SwaggerUIBundle({
      url: sYamlFile,
      oauth2RedirectUrl: sRedirectPath,
      dom_id: '#swagger-ui',
      deepLinking: true,
      defaultModelExpandDepth: 3,
      presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIStandalonePreset
      ],
      plugins: [
        SwaggerUIBundle.plugins.DownloadUrl
      ],
      layout: "StandaloneLayout",
      validatorUrl: null,
    })

    window.ui.initOAuth({
        clientId: "fMVnoXXtce375mXR",
        clientSecret: "",
        appName: "MPS Server API Documentation",
        scopeSeparator: " ",
        scopes: "bulk server_read",
        additionalQueryStringParams: {},
        usePkceWithAuthorizationCodeGrant: true
      })
    // End Swagger UI call region
  }
</script>
</body>
</html>
