"use client";

import { useState } from "react";
import makeContext from "@/lib/contextFactory/contextFactory";

export type View = "board" | "table" | "schedule";

type ViewContextState = {
    view: View;
    setView: (view: View) => void;
};

const useViewContextState = (): ViewContextState => {
    const [view, setView] = useState<View>("board");

    return {
        view,
        setView,
    };
};

export const [ViewContextProvider, useViewContext] =
    makeContext<ViewContextState>(useViewContextState, "View");
