"use client"

import { createContext, useContext, type ReactNode } from "react"

export const DEFAULT_AGENDA_ROUTE_ROOT = "agenda"

const AgendaRouteRootContext = createContext(DEFAULT_AGENDA_ROUTE_ROOT)

export function AgendaRouteRootProvider({
  routeRoot = DEFAULT_AGENDA_ROUTE_ROOT,
  children,
}: {
  routeRoot?: string
  children: ReactNode
}) {
  return (
    <AgendaRouteRootContext.Provider value={routeRoot}>
      {children}
    </AgendaRouteRootContext.Provider>
  )
}

export function useAgendaRouteRoot(): string {
  return useContext(AgendaRouteRootContext)
}
