import type { App } from 'vue'

const config: Application = {
    appName: __APP__.appName,
    name: __APP__.name,
    version: __APP__.version,
    description: __APP__.description,
    author: __APP__.author,
    lastBuildTime: __APP__.lastBuildTime,
}

export const $app = config

export function setupAppConfig(app: App<Element>) {
    // 打印 App 信息
    // #ifdef H5
    console.log(
        `%c APP %c ${config.name} %c V${config.version} `,
        'padding: 2px 1px; border-radius: 3px; color: #fff; background: #fa593b; font-weight: bold; margin-right: 5px;',
        'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;',
        'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;',
    )
    // #endif

    app.config.globalProperties.$app = $app
}

declare module '@vue/runtime-core' {
    interface ComponentCustomProperties {
        $app: Application
    }
}
