'use strict';

var backendPluginApi = require('@backstage/backend-plugin-api');
var router = require('./router.cjs.js');
var permissionsRouter = require('./permissions-router.cjs.js');

const kuadrantPlugin = backendPluginApi.createBackendPlugin({
  pluginId: "kuadrant",
  register(env) {
    env.registerInit({
      deps: {
        httpAuth: backendPluginApi.coreServices.httpAuth,
        userInfo: backendPluginApi.coreServices.userInfo,
        httpRouter: backendPluginApi.coreServices.httpRouter,
        config: backendPluginApi.coreServices.rootConfig,
        permissions: backendPluginApi.coreServices.permissions
      },
      async init({ httpAuth, userInfo, httpRouter, config, permissions }) {
        httpRouter.addAuthPolicy({
          path: "/",
          allow: "unauthenticated"
        });
        httpRouter.use(permissionsRouter.createKuadrantPermissionIntegrationRouter());
        httpRouter.use(
          await router.createRouter({
            httpAuth,
            userInfo,
            config,
            permissions
          })
        );
      }
    });
  }
});

exports.kuadrantPlugin = kuadrantPlugin;
//# sourceMappingURL=plugin.cjs.js.map
