import React from 'react'
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import App from './App'
import { ContractList } from './components/ContractList'
import { ContractDetail } from './components/ContractDetail'
import { FileDetail } from './components/FileDetail'
import { DaemonList } from './components/DaemonList'
import { DaemonDetail } from './components/DaemonDetail'
import { DocumentLayout } from './components/document'
import './styles/pc98.css'
import './styles/mobile.css'

// Route configuration:
// - /contracts - List all contracts
// - /contracts/:id - View contract details with tabs (including Files tab)
// - /contracts/:contractId/files/:fileId - View a specific file within contract context
//
// Note: Standalone file routes (/files, /files/:id) have been removed.
// Files are now only accessible through their parent contract.

const router = createBrowserRouter([
  {
    path: '/',
    element: <App />,
  },
  {
    path: '/contracts',
    element: <ContractList />,
  },
  {
    path: '/contracts/:id',
    element: <ContractDetail />,
  },
  {
    path: '/contracts/:contractId/files/:fileId',
    element: <FileDetail />,
  },
  {
    path: '/daemons',
    element: <DaemonList />,
  },
  {
    path: '/daemons/:id',
    element: <DaemonDetail />,
  },
  {
    path: '/directives',
    element: <DocumentLayout />,
  },
  {
    path: '/directives/:id',
    element: <DocumentLayout />,
  },
])

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <RouterProvider router={router} />
  </React.StrictMode>
)
