import { applyLocalizedContent } from "@open-mercato/shared/lib/localization/resolver";
import { batchLoadTranslations } from "./batch.js";
function resolveDb(container) {
  const em = container.resolve("em");
  return em.getKysely();
}
async function applyTranslationOverlays(items, options) {
  const db = resolveDb(options.container);
  const entityIds = items.map((item) => String(item.id)).filter(Boolean);
  const translationsMap = await batchLoadTranslations(db, options.entityType, entityIds, {
    tenantId: options.tenantId,
    organizationId: options.organizationId
  });
  return items.map((item) => {
    const entityId = String(item.id);
    const translations = translationsMap.get(entityId);
    return applyLocalizedContent(item, translations ?? null, options.locale);
  });
}
export {
  applyTranslationOverlays
};
//# sourceMappingURL=apply.js.map
