function mapActions(actions) {
  if (!actions || actions.length === 0) return void 0;
  return actions.map((action) => ({
    id: action.id,
    label: action.labelKey,
    labelKey: action.labelKey,
    variant: action.variant,
    icon: action.icon,
    commandId: action.commandId,
    href: action.href,
    confirmRequired: action.confirmRequired,
    confirmMessage: action.confirmMessageKey
  }));
}
function buildBaseNotificationFields(typeDef, options) {
  return {
    type: typeDef.type,
    titleKey: typeDef.titleKey,
    bodyKey: typeDef.bodyKey,
    titleVariables: options.titleVariables,
    bodyVariables: options.bodyVariables,
    title: typeDef.titleKey,
    body: typeDef.bodyKey,
    icon: typeDef.icon,
    severity: typeDef.severity,
    actions: mapActions(typeDef.actions),
    primaryActionId: typeDef.primaryActionId,
    sourceModule: typeDef.module,
    sourceEntityType: options.sourceEntityType,
    sourceEntityId: options.sourceEntityId,
    linkHref: options.linkHref ?? typeDef.linkHref,
    groupKey: options.groupKey,
    expiresAt: options.expiresAt ?? (typeDef.expiresAfterHours ? new Date(Date.now() + typeDef.expiresAfterHours * 60 * 60 * 1e3).toISOString() : void 0)
  };
}
function buildNotificationFromType(typeDef, options) {
  return {
    recipientUserId: options.recipientUserId,
    ...buildBaseNotificationFields(typeDef, options)
  };
}
function buildBatchNotificationFromType(typeDef, options) {
  return {
    recipientUserIds: options.recipientUserIds,
    ...buildBaseNotificationFields(typeDef, options)
  };
}
function buildRoleNotificationFromType(typeDef, options) {
  return {
    roleId: options.roleId,
    ...buildBaseNotificationFields(typeDef, options)
  };
}
function buildFeatureNotificationFromType(typeDef, options) {
  return {
    requiredFeature: options.requiredFeature,
    ...buildBaseNotificationFields(typeDef, options)
  };
}
export {
  buildBatchNotificationFromType,
  buildFeatureNotificationFromType,
  buildNotificationFromType,
  buildRoleNotificationFromType
};
//# sourceMappingURL=notificationBuilder.js.map
