import { BackendDynamicPluginInstaller } from "@backstage/backend-dynamic-feature-service";
import { analyticsModuleGenericPlugin } from "@pfeifferj/backstage-plugin-analytics-generic";

export const dynamicPluginInstaller: BackendDynamicPluginInstaller = {
  kind: "legacy",
  id: "generic-analytics",
  apis: [
    createApiFactory({
      api: analyticsApiRef,
      deps: {
        configApi: configApiRef,
        errorApi: errorApiRef,
        identityApi: identityApiRef,
        catalogApi: catalogApiRef,
      },
      factory: ({ configApi, errorApi, identityApi, catalogApi }) =>
        GenericAnalyticsAPI.fromConfig(
          configApi,
          errorApi,
          identityApi,
          catalogApi
        ),
    }),
  ],
};
