"use client"

import { createContext, useContext } from "react"

type VendorContextValue = {
    id: string
    label: string
}

const VendorContext = createContext<VendorContextValue | null>(null)

export function VendorProvider({
    vendor,
    children,
}: {
    vendor: VendorContextValue
    children: React.ReactNode
}) {
    return (
        <VendorContext.Provider value={vendor}>
            {children}
        </VendorContext.Provider>
    )
}

export function useVendor() {
    return useContext(VendorContext)
}
