import { defineRouting } from 'next-intl/routing'
import { createNavigation } from 'next-intl/navigation'

// 定義路由配置
export const routing = defineRouting({
  // 支援的語系列表
  locales: ['zh-TW', 'en'],

  // 預設語系 (繁體中文)
  defaultLocale: 'zh-TW',

  // 永遠顯示語系前綴
  localePrefix: 'always',
})

// 匯出導航工具
export const { Link, redirect, usePathname, useRouter, getPathname } =
  createNavigation(routing)

// 匯出類型
export type Locale = (typeof routing.locales)[number]
export const locales = routing.locales
export const defaultLocale = routing.defaultLocale

// 語系名稱對照
export const localeNames: Record<Locale, string> = {
  'zh-TW': '繁體中文',
  en: 'English',
}

// 語系短名稱 (用於切換器)
export const localeShortNames: Record<Locale, string> = {
  'zh-TW': '繁中',
  en: 'EN',
}
