import ChatChannelPage from '@/pages/secondary/ChatChannelPage'
import AppearanceSettingsPage from '@/pages/secondary/AppearanceSettingsPage'
import BookmarkPage from '@/pages/secondary/BookmarkPage'
import DMConversationPage from '@/pages/secondary/DMConversationPage'
import EmojiPackSettingsPage from '@/pages/secondary/EmojiPackSettingsPage'
import ExternalContentPage from '@/pages/secondary/ExternalContentPage'
import FollowingListPage from '@/pages/secondary/FollowingListPage'
import FollowPackPage from '@/pages/secondary/FollowPackPage'
import GeneralSettingsPage from '@/pages/secondary/GeneralSettingsPage'
import HelpPage from '@/pages/secondary/HelpPage'
import LoginPage from '@/pages/secondary/LoginPage'
import LogoutPage from '@/pages/secondary/LogoutPage'
import MuteListPage from '@/pages/secondary/MuteListPage'
import NoteListPage from '@/pages/secondary/NoteListPage'
import NotePage from '@/pages/secondary/NotePage'
import OthersRelaySettingsPage from '@/pages/secondary/OthersRelaySettingsPage'
import PostSettingsPage from '@/pages/secondary/PostSettingsPage'
import ProfileEditorPage from '@/pages/secondary/ProfileEditorPage'
import ProfileListPage from '@/pages/secondary/ProfileListPage'
import ProfilePage from '@/pages/secondary/ProfilePage'
import RelayPage from '@/pages/secondary/RelayPage'
import RelayReviewsPage from '@/pages/secondary/RelayReviewsPage'
import RelaySettingsPage from '@/pages/secondary/RelaySettingsPage'
import RizfulPage from '@/pages/secondary/RizfulPage'
import SearchPage from '@/pages/secondary/SearchPage'
import SettingsPage from '@/pages/secondary/SettingsPage'
import SystemSettingsPage from '@/pages/secondary/SystemSettingsPage'
import WalletPage from '@/pages/secondary/WalletPage'
import { match } from 'path-to-regexp'
import { isValidElement } from 'react'

// Right column routes
const SECONDARY_ROUTE_CONFIGS = [
  { path: '/login', element: <LoginPage /> },
  { path: '/logout', element: <LogoutPage /> },
  { path: '/notes', element: <NoteListPage /> },
  { path: '/notes/:id', element: <NotePage /> },
  { path: '/users', element: <ProfileListPage /> },
  { path: '/users/:id', element: <ProfilePage /> },
  { path: '/users/:id/following', element: <FollowingListPage /> },
  { path: '/users/:id/relays', element: <OthersRelaySettingsPage /> },
  { path: '/relays/:url', element: <RelayPage /> },
  { path: '/relays/:url/reviews', element: <RelayReviewsPage /> },
  { path: '/search', element: <SearchPage /> },
  { path: '/external-content', element: <ExternalContentPage /> },
  { path: '/settings', element: <SettingsPage /> },
  { path: '/help', element: <HelpPage /> },
  { path: '/settings/relays', element: <RelaySettingsPage /> },
  { path: '/settings/wallet', element: <WalletPage /> },
  { path: '/settings/posts', element: <PostSettingsPage /> },
  { path: '/settings/general', element: <GeneralSettingsPage /> },
  { path: '/settings/appearance', element: <AppearanceSettingsPage /> },
  { path: '/settings/emoji-packs', element: <EmojiPackSettingsPage /> },
  { path: '/settings/system', element: <SystemSettingsPage /> },
  { path: '/profile-editor', element: <ProfileEditorPage /> },
  { path: '/mutes', element: <MuteListPage /> },
  { path: '/rizful', element: <RizfulPage /> },
  { path: '/bookmarks', element: <BookmarkPage /> },
  { path: '/dm/:pubkey', element: <DMConversationPage /> },
  { path: '/follow-packs/:id', element: <FollowPackPage /> },
  { path: '/chat/:channelId', element: <ChatChannelPage /> }
]

export const SECONDARY_ROUTES = SECONDARY_ROUTE_CONFIGS.map(({ path, element }) => ({
  path,
  element: isValidElement(element) ? element : null,
  matcher: match(path)
}))
