import { asClass, asFunction } from "awilix";
import { AuthService } from "@open-mercato/core/modules/auth/services/authService";
import { RbacService } from "@open-mercato/core/modules/auth/services/rbacService";
import {
  createRbacFallbackCache,
  isRbacDefaultCacheEnabled,
  resetRbacFallbackCache
} from "@open-mercato/core/modules/auth/services/rbacDefaultCache";
function register(container) {
  container.register({ authService: asClass(AuthService).scoped() });
  if (isRbacDefaultCacheEnabled()) {
    container.register({
      rbacService: asFunction((cradle) => {
        return new RbacService(cradle.em, cradle.cache ?? createRbacFallbackCache());
      }).scoped()
    });
  } else {
    container.register({ rbacService: asClass(RbacService).scoped() });
  }
}
export {
  register,
  resetRbacFallbackCache
};
//# sourceMappingURL=di.js.map
