import { ensureMongoDocumentToObject } from "../ensureMongoDocumentToObject.mjs";

//#region src/utils/mapper/user.ts
/**
* Formats a user for API response. Removes sensitive information and adds role.
* @param user - The user object to format.
* @returns The formatted user object.
*/
const mapUserToAPI = (user) => {
	if (!user) return null;
	const { provider, session, ...userAPI } = ensureMongoDocumentToObject(user);
	return userAPI;
};
/**
* Formats an array of users for API response. Removes sensitive information and adds role.
* @param users - The array of user objects to format.
* @returns The formatted array of user objects.
*/
const mapUsersToAPI = (users) => users.map(mapUserToAPI).filter(Boolean);

//#endregion
export { mapUserToAPI, mapUsersToAPI };
//# sourceMappingURL=user.mjs.map