import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// 注意：shared 的样式现在通过 index.html 中的 <link> 标签加载
// 不再需要在这里导入：import 'shared/styles'

import App from './App.vue'
import router from './router/'

// 导入需要的 Lucide 图标
import {
    LayoutGrid,
    FileText,
    Users,
    User,
    Settings,
    Home,
    ChevronDown,
    ChevronRight,
    ChevronLeft,
    PanelLeftClose,
    PanelLeftOpen,
    RefreshCw,
    LogOut,
    Plus,
    Trash2,
    Search,
    Menu
} from 'lucide-vue-next'

// Lucide 图标映射
const lucideIcons = {
    LayoutGrid,
    FileText,
    Users,
    User,
    Settings,
    Home,
    ChevronDown,
    ChevronRight,
    ChevronLeft,
    PanelLeftClose,
    PanelLeftOpen,
    RefreshCw,
    LogOut,
    Plus,
    Trash2,
    Search,
    Menu
}

// 异步初始化应用
async function initApp() {
    // 创建 Vue 应用
    const app = createApp(App)

    // 注册 Pinia
    const pinia = createPinia()
    app.use(pinia)

    // 注册 Element Plus
    app.use(ElementPlus)

    // 注册 Lucide 图标
    for (const [name, component] of Object.entries(lucideIcons)) {
        app.component(name, component)
    }

    // 注册路由
    app.use(router)

    // 挂载应用
    app.mount('#app')
    
    console.log('✅ Bidding 应用启动成功')
}

// 启动应用
initApp()
