import { ElMessage as Message, ElMessageBox, ElMessageBoxOptions, ElMessageBoxShortcutMethod } from "element-plus"

function createConfirm(
    options: ElMessageBoxOptions
): ElMessageBoxShortcutMethod {
    const opt: ElMessageBoxOptions = {
        // type: type,
        // icon: getIcon(icons),
        ...options,
    };
    return ElMessageBox.confirm(opt.message, opt) as unknown as ElMessageBoxShortcutMethod;
}

/**
 * 
 *  @returns createMessage： 创建提示框
 *  @returns createConfirm： 创建对话框
 */
export function useMessage() {

    return {
        createMessage: Message,
        createConfirm: createConfirm,
        ElMessageBox
    };
}