import type { Component } from 'vue'
import {
  AppstoreOutlined,
  BellOutlined,
  CustomerServiceOutlined,
  FileTextOutlined,
  GiftOutlined,
  HomeOutlined,
  MailOutlined,
  ShoppingCartOutlined,
  ShoppingOutlined,
  UnorderedListOutlined,
  ProfileOutlined,
  WalletOutlined,
  StarOutlined,
} from '@ant-design/icons-vue'

export type ConsoleNavItem = {
  key: string
  label: string
  icon?: Component
  to: string
}

export type ConsoleNavGroup = {
  key: string
  label: string
  icon?: Component
  iconColor?: string
  badge?: string
  disabled?: boolean
  children: ConsoleNavItem[]
}

export type ConsoleNavLink = Omit<ConsoleNavGroup, 'children'> & {
  to: string
}

export type ConsoleNavEntry = ConsoleNavGroup | ConsoleNavLink

export const consoleNav: ConsoleNavEntry[] = [
  {
    key: 'console-home',
    label: '控制台',
    icon: HomeOutlined,
    to: '/console',
  },
  {
    key: 'console-apps',
    label: '应用中心',
    icon: AppstoreOutlined,
    to: '/console/apps',
  },
  // {
  //   key: 'console-store',
  //   label: '应用商店',
  //   icon: ShoppingOutlined,
  //   to: '/market',
  // },
  {
    key: 'console-products',
    label: '我的产品',
    icon: ShoppingOutlined,
    children: [
      { key: 'console-products-list', label: '已购产品', icon: ShoppingOutlined, to: '/console/products' },
      { key: 'console-products-coupons', label: '优惠券', icon: GiftOutlined, to: '/console/coupons' },
    ],
  },
  {
    key: 'console-account-finance',
    label: '账户资产',
    icon: WalletOutlined,
    children: [
      { key: 'console-recharge', label: '充值余额', icon: WalletOutlined, to: '/console/recharge' },
      { key: 'console-points', label: '积分明细', icon: StarOutlined, to: '/console/points' },
    ],
  },
  {
    key: 'console-orders',
    label: '订单与账单',
    icon: ShoppingCartOutlined,
    children: [
      { key: 'console-orders-list', label: '订单记录', icon: UnorderedListOutlined, to: '/console/orders' },
      { key: 'console-orders-invoices', label: '发票记录', icon: FileTextOutlined, to: '/console/invoices' },
      { key: 'console-contracts', label: '合同管理', icon: ProfileOutlined, to: '/console/contracts' },
    ],
  },
  {
    key: 'console-tickets',
    label: '工单管理',
    icon: CustomerServiceOutlined,
    badge: 'NEW',
    to: '/console/tickets',
  },
  {
    key: 'console-notifications',
    label: '消息通知',
    icon: BellOutlined,
    badge: 'NEW',
    to: '/console/notifications',
  },
  // {
  //   key: 'console-invites',
  //   label: '应用邀请',
  //   icon: MailOutlined,
  //   badge: 'NEW',
  //   to: '/console/invites',
  // },
]
