interface PageInfo {
  path: string
  name: string
  description?: string
  category?: string
}

class PageRegistry {
  private pages: PageInfo[] = [
    {
      path: "/",
      name: "数据概览",
      description: "平台整体数据分析",
      category: "核心功能",
    },
    {
      path: "/data-platform",
      name: "数据中台",
      description: "多源数据整合中心",
      category: "核心功能",
    },
    {
      path: "/user-discovery",
      name: "用户发现",
      description: "用户行为洞察分析",
      category: "用户分析",
    },
    {
      path: "/user-valuation",
      name: "用户估值",
      description: "用户价值评估模型",
      category: "价值分析",
    },
    {
      path: "/ai-analysis",
      name: "AI分析",
      description: "智能数据洞察",
      category: "AI功能",
    },
    {
      path: "/devices",
      name: "设备管理",
      description: "设备状态监控",
      category: "系统管理",
    },
    {
      path: "/traffic-pool",
      name: "流量池",
      description: "流量数据管理",
      category: "系统管理",
    },
    {
      path: "/documentation",
      name: "文档生成",
      description: "自动文档生成",
      category: "工具",
    },
  ]

  getAllPages(): PageInfo[] {
    return this.pages
  }

  getPagesByCategory(category: string): PageInfo[] {
    return this.pages.filter((page) => page.category === category)
  }

  getPageByPath(path: string): PageInfo | undefined {
    return this.pages.find((page) => page.path === path)
  }

  addPage(page: PageInfo): void {
    this.pages.push(page)
  }

  removePage(path: string): void {
    this.pages = this.pages.filter((page) => page.path !== path)
  }

  getCategories(): string[] {
    const categories = new Set(this.pages.map((page) => page.category).filter(Boolean))
    return Array.from(categories) as string[]
  }
}

export const pageRegistry = new PageRegistry()
export type { PageInfo }
