import { createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
import { OptimizationsApiClient } from '@marek.libra/plugin-redhat-resource-optimization-common';
import { rootRouteRef, optimizationsBreakdownRouteRef } from './routes.esm.js';
import { optimizationsApiRef } from './apis.esm.js';

const resourceOptimizationPlugin = createPlugin({
  id: "redhat-resource-optimization",
  apis: [
    createApiFactory({
      api: optimizationsApiRef,
      deps: {
        discoveryApi: discoveryApiRef,
        fetchApi: fetchApiRef
      },
      factory({ discoveryApi, fetchApi }) {
        return new OptimizationsApiClient({
          discoveryApi,
          fetchApi
        });
      }
    })
  ],
  routes: {
    root: rootRouteRef,
    breakdown: optimizationsBreakdownRouteRef
  }
});
const ResourceOptimizationPage = resourceOptimizationPlugin.provide(
  createRoutableExtension({
    name: "ResourceOptimizationPage",
    component: () => import('./pages/Router.esm.js').then((m) => m.Router),
    mountPoint: rootRouteRef
  })
);

export { ResourceOptimizationPage, resourceOptimizationPlugin };
//# sourceMappingURL=plugin.esm.js.map
