import { ref } from 'vue'
import useConfig from './useConfig'

export default async () => {
    const { refreshConfig } = useConfig()

    const plugins = ref([])

    plugins.value = await window.api.listPlugins()

    const setActivePlugin = async (pluginId) => {
        await window.api.setActivePlugin(pluginId)
        await refreshConfig()
    }

    return {
        plugins,
        setActivePlugin,
    }
}
