"use client"

import { createContext, useContext } from "react"

type CustomerContextValue = {
    id: string
    label: string
}

const CustomerContext = createContext<CustomerContextValue | null>(null)

export function CustomerProvider({
    customer,
    children,
}: {
    customer: CustomerContextValue
    children: React.ReactNode
}) {
    return (
        <CustomerContext.Provider value={customer}>
            {children}
        </CustomerContext.Provider>
    )
}

export function useCustomer() {
    return useContext(CustomerContext)
}
