"use client";

import { createContext, useContext } from "react";

type Language = {
  title: string;
  slug: string;
};

export const LanguageContext = createContext<Language[] | null>(null);

export const useLanguages = () => {
  const context = useContext(LanguageContext);

  if (!context) {
    throw new Error("useLanguages must be used inside LanguageProvider");
  }

  return context;
};
