//
// Copyright 2023 DXOS.org
//
import React, { useCallback } from 'react';
import { useNavigate, useRoutes as useRouterRoutes } from 'react-router-dom';
import { RootContainer } from '../containers';
import { AutomergePanel, ConfigPanel, CredentialsPanel, DeviceListPanel, DiagnosticsPanel, EdgeDashboardPanel, FeedsPanel, IdentityPanel, InvocationTracePanel, KeyringPanel, LoggingPanel, MembersPanel, MetadataPanel, NetworkPanel, ObjectsPanel, SignalPanel, SpaceInfoPanel, SpaceListPanel, StoragePanel, SwarmPanel, TestingPanel, TracingPanel, WorkflowPanel, } from '../panels';
export const namespace = 'devtools';
/**
 * Main app routes.
 * https://reactrouter.com/en/main
 */
export const useRoutes = () => {
    const navigate = useNavigate();
    const handleSelectSpace = useCallback(() => navigate('/echo/space'), [navigate]);
    const handleSelectFeed = useCallback(() => navigate('/echo/feeds'), [navigate]);
    return useRouterRoutes([
        {
            path: '/',
            element: React.createElement(RootContainer, null),
            children: [
                {
                    path: '/client',
                    children: [
                        {
                            path: '/client/config',
                            element: React.createElement(ConfigPanel, null),
                        },
                        {
                            path: '/client/storage',
                            element: React.createElement(StoragePanel, null),
                        },
                        {
                            path: '/client/logs',
                            element: React.createElement(LoggingPanel, null),
                        },
                        {
                            path: '/client/diagnostics',
                            element: React.createElement(DiagnosticsPanel, null),
                        },
                        {
                            path: '/client/tracing',
                            element: React.createElement(TracingPanel, null),
                        },
                    ],
                },
                {
                    path: '/halo',
                    children: [
                        {
                            path: '/halo/identity',
                            element: React.createElement(IdentityPanel, null),
                        },
                        {
                            path: '/halo/devices',
                            element: React.createElement(DeviceListPanel, null),
                        },
                        {
                            path: '/halo/keyring',
                            element: React.createElement(KeyringPanel, null),
                        },
                        {
                            path: '/halo/credentials',
                            element: React.createElement(CredentialsPanel, null),
                        },
                    ],
                },
                {
                    path: '/echo',
                    children: [
                        {
                            path: '/echo/spaces',
                            element: React.createElement(SpaceListPanel, { onSelect: handleSelectSpace }),
                        },
                        {
                            path: '/echo/space',
                            element: React.createElement(SpaceInfoPanel, { onSelectFeed: handleSelectFeed, onSelectPipeline: handleSelectFeed }),
                        },
                        {
                            path: '/echo/feeds',
                            element: React.createElement(FeedsPanel, null),
                        },
                        {
                            path: '/echo/objects',
                            element: React.createElement(ObjectsPanel, null),
                        },
                        {
                            path: '/echo/automerge',
                            element: React.createElement(AutomergePanel, null),
                        },
                        {
                            path: '/echo/members',
                            element: React.createElement(MembersPanel, null),
                        },
                        {
                            path: '/echo/metadata',
                            element: React.createElement(MetadataPanel, null),
                        },
                    ],
                },
                {
                    path: '/mesh',
                    children: [
                        {
                            path: '/mesh/signal',
                            element: React.createElement(SignalPanel, null),
                        },
                        {
                            path: '/mesh/swarm',
                            element: React.createElement(SwarmPanel, null),
                        },
                        {
                            path: '/mesh/network',
                            element: React.createElement(NetworkPanel, null),
                        },
                    ],
                },
                {
                    path: '/edge',
                    children: [
                        {
                            path: '/edge/workflows',
                            element: React.createElement(WorkflowPanel, null),
                        },
                        {
                            path: '/edge/dashboard',
                            element: React.createElement(EdgeDashboardPanel, null),
                        },
                        {
                            path: '/edge/traces',
                            element: React.createElement(InvocationTracePanel, null),
                        },
                        {
                            path: '/edge/testing',
                            element: React.createElement(TestingPanel, null),
                        },
                    ],
                },
            ],
        },
    ]);
};
//# sourceMappingURL=useRoutes.js.map