import { createContext, useContext } from "react";
import type { AnnuncioData } from "~/server/controllers/annunci.controller";

export const AnnuncioContext = createContext<AnnuncioData | null>(null);

export const useAnnuncio = () => {
	const context = useContext(AnnuncioContext);
	if (!context) {
		throw new Error("useAnnuncio must be used within a AnnuncioProvider");
	}
	return context;
};
