"use client"

import { createContext, useContext } from "react"

type EmployeeContextValue = {
    id: string
    label: string
}

const EmployeeContext = createContext<EmployeeContextValue | null>(null)

export function EmployeeProvider({
    employee,
    children,
}: {
    employee: EmployeeContextValue
    children: React.ReactNode
}) {
    return (
        <EmployeeContext.Provider value={employee}>
            {children}
        </EmployeeContext.Provider>
    )
}

export function useEmployee() {
    return useContext(EmployeeContext)
}
