import type { GlobConfig } from '/#/config'

import { getAppEnvConfig } from '/@/utils/env'

export const useGlobSetting = (): Readonly<GlobConfig> => {
    const {
        VITE_GLOB_APP_NAME,
        VITE_GLOB_APP_DESCRIPTION,
        VITE_GLOB_API_URL,
        VITE_GLOB_API_URL_PREFIX,
        VITE_GLOB_UPLOAD_URL,
    } = getAppEnvConfig()

    // Take global configuration
    const glob: Readonly<GlobConfig> = {
        name: VITE_GLOB_APP_NAME,
        description: VITE_GLOB_APP_DESCRIPTION,
        apiUrl: VITE_GLOB_API_URL,
        urlPrefix: VITE_GLOB_API_URL_PREFIX,
        uploadUrl: VITE_GLOB_UPLOAD_URL,
    }

    return glob as Readonly<GlobConfig>
}
