const Message = {
    info: (msg: string) => {
        uni.showToast({
            title: msg,
            icon: 'none',
        })
    },
    warn: (msg: string) => {
        uni.showToast({
            title: msg,
            icon: 'none',
            position: 'bottom',
        })
    },
    success: (msg: string) => {
        uni.showToast({
            title: msg,
            icon: 'success',
        })
    },
    error: (msg: string) => {
        uni.showToast({
            title: msg,
            icon: 'none',
        })
    },
}

function createErrorModal(options: { title: string; content: string }) {
    uni.showModal({
        title: options.title,
        content: options.content,
        showCancel: false,
    })
}

/**
 * @description: message
 */
export function useMessage() {
    return {
        createMessage: Message,
        createErrorModal,
    }
}
