/**
 * For outlook related operations.
 */

/**
 * Displays a UI notification message in the Outlook add-in.
 *
 * @param msg - The message to display to the user.
 * @param isError - Optional. If true, displays the message as an error; otherwise, as an informational message. Defaults to false.
 *
 * The function uses the Office.js API to show a notification message in the current Outlook item.
 * If `isError` is true, the message is shown as an error with a different icon and is not persistent.
 * Otherwise, it is shown as an informational message with a default icon and is persistent.
 */
export const showUIMessage = (msg:string, isError:boolean = false) => {
	const message:Office.NotificationMessageDetails = {
		type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
		message: msg,
		icon: "addIconx80",
		persistent: true
	};
	if (isError){
		message.type = Office.MailboxEnums.ItemNotificationMessageType.ErrorMessage;
		message.icon = "aboutIconx80"
		message.persistent = false;
	}
	Office.context.mailbox.item.notificationMessages.replaceAsync("action", message);
}