import type { GetStaticProps } from 'next'
import BridgeMonitoringPage from '@/components/explorer/BridgeMonitoringPage'
import type { MissionControlBridgeStatusResponse } from '@/services/api/missionControl'
import type { ExplorerStats } from '@/services/api/stats'
import { fetchExplorerTruthContext } from '@/utils/serverExplorerContext'

interface BridgePageProps {
  initialBridgeStatus: MissionControlBridgeStatusResponse | null
  initialStats: ExplorerStats | null
}

export default function BridgePage(props: BridgePageProps) {
  return <BridgeMonitoringPage {...props} />
}

export const getStaticProps: GetStaticProps<BridgePageProps> = async () => {
  const truthContext = await fetchExplorerTruthContext()

  return {
    props: {
      initialBridgeStatus: truthContext.initialBridgeStatus,
      initialStats: truthContext.initialStats,
    },
  }
}
