import { createRouter, createWebHistory } from 'vue-router'

export const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: '/', redirect: '/home' },
    { path: '/home', component: () => import('../features/home/pages/HomePage.vue'), meta: { screenId: 'SCR-000', templateId: 'T00', module: 'Home', section: 'Home', title: '홈', order: 0, favoriteAllowed: false } },
    { path: '/research/sell-decision', component: () => import('../features/sell-decision/pages/SellDecisionPage.vue'), meta: { screenId: 'SCR-002', templateId: 'T03', module: 'Research', section: 'Research', title: '매도 의사결정', order: 1, favoriteAllowed: true } },
    { path: '/ops/data-quality', component: () => import('../features/data-quality/pages/DataQualityPage.vue'), meta: { screenId: 'SCR-013', templateId: 'T08', module: 'Operations', section: 'Operations', title: '데이터 품질', order: 1, favoriteAllowed: true } },
    { path: '/ops/model-operations', component: () => import('../features/model-operations/pages/ModelOperationsPage.vue'), meta: { screenId: 'SCR-015', templateId: 'T10', module: 'Operations', section: 'Operations', title: '모델 운영', order: 4, favoriteAllowed: true } },
    { path: '/ops/market-data-ingestion', component: () => import('../features/marketData/pages/MarketDataIngestion.vue'), meta: { screenId: 'SCR-016', templateId: 'T08', module: 'Operations', section: 'Operations', title: '시장 데이터 수집', order: 2, favoriteAllowed: true } },
    { path: '/ops/market-data-history', component: () => import('../features/marketData/pages/IngestionStatus.vue'), meta: { screenId: 'SCR-017', templateId: 'T08', module: 'Operations', section: 'Operations', title: '수집 이력', order: 3, favoriteAllowed: true } },
    { path: '/portfolio/risk', component: () => import('../features/portfolio/pages/RiskDashboard.vue'), meta: { screenId: 'SCR-018', templateId: 'T07', module: 'Portfolio', section: 'Portfolio', title: '포트폴리오 리스크', order: 1, favoriteAllowed: true } },
    { path: '/portfolio/rebalance', component: () => import('../features/portfolio/pages/RebalanceForm.vue'), meta: { screenId: 'SCR-019', templateId: 'T03', module: 'Portfolio', section: 'Portfolio', title: '리밸런싱 제안', order: 2, favoriteAllowed: true } },
    { path: '/internal/ui-standard', component: () => import('../features/ui-standard/pages/UiStandardPage.vue'), meta: { screenId: 'SCR-DEV-001', templateId: 'T01', module: 'Design System', section: 'Design System', title: '컴포넌트 확인', order: 1, favoriteAllowed: false, internalOnly: false } },
    { path: '/internal/wbs', component: () => import('../features/wbs/pages/WbsWorkspacePage.vue'), meta: { screenId: 'SCR-DEV-002', templateId: 'T01', module: 'Internal', section: 'Internal', title: 'WBS 작업공간', order: 1, favoriteAllowed: false, internalOnly: true } },
    // KBX Foundation v4 routes (registry-driven)
    { path: '/model-ops/shadow-runs', component: () => import('../features/shadow-run/pages/ShadowRunList.vue'), meta: { screenId: 'model-ops.shadow-run.list', module: 'ModelOps', title: 'Shadow Run Validation', permissions: ['model.read'] } },
    { path: '/model-ops/shadow-runs/:runId', component: () => import('../features/shadow-run/pages/ShadowRunDetail.vue'), meta: { screenId: 'model-ops.shadow-run.detail', module: 'ModelOps', title: 'Shadow Run Details', permissions: ['model.read'] } },
    { path: '/model-ops/models', component: () => import('../features/models/pages/ModelsList.vue'), meta: { screenId: 'model-ops.models.list', module: 'ModelOps', title: 'Model Management', permissions: ['model.read'] } },
    { path: '/model-ops/models/:modelId', component: () => import('../features/models/pages/ModelDetail.vue'), meta: { screenId: 'model-ops.models.detail', module: 'ModelOps', title: 'Model Details', permissions: ['model.read'] } }
  ]
})
