import { create } from "zustand";
import { TXCalendarEvent } from "@core/app/theme/scheduleView";

interface IClipboardStore {
    copiedAppointment: TXCalendarEvent | null;
    setCopiedAppointment: (event: TXCalendarEvent | null) => void;
    clear: () => void;
}

export type ClipboardState = IClipboardStore;

const useClipboardStore = create<ClipboardState>()((set) => ({
    copiedAppointment: null,
    setCopiedAppointment: (event: TXCalendarEvent | null) =>
        set(() => ({
            copiedAppointment: event,
        })),
    clear: () =>
        set(() => ({
            copiedAppointment: null,
        })),
}));

export { useClipboardStore };
