"use client";
import { MissionOptionalDefaults } from "@repo/db/zod";
import { create } from "zustand";

interface PannelStore {
	isOpen: boolean;
	setOpen: (isOpen: boolean) => void;
	missionFormValues?: Partial<MissionOptionalDefaults>;
	setMissionFormValues: (values: Partial<MissionOptionalDefaults>) => void;
	isEditingMission: boolean;
	editingMissionId: number | null;
	setEditingMission: (isEditing: boolean, missionId: number | null) => void;
}

export const usePannelStore = create<PannelStore>((set) => ({
	isOpen: false,
	setOpen: (isOpen) => set({ isOpen }),
	missionFormValues: undefined,
	setMissionFormValues: (values) => set({ missionFormValues: values }),
	isEditingMission: false,
	editingMissionId: null,
	setEditingMission: (isEditing, missionId) =>
		set({ isEditingMission: isEditing, editingMissionId: missionId }),
}));
