import { create } from "zustand";

interface ToggleState {
  toggleUILeft: boolean;
  toggleUIRight: boolean;
  setToggleUI: (value1: boolean, value2: boolean) => void;
}

export const useToggleStore = create<ToggleState>((set) => ({
  toggleUILeft: true,
  toggleUIRight: false,
  setToggleUI: (value1: boolean, value2: boolean) => {
    set({ toggleUILeft: value1, toggleUIRight: value2 });
  },
}));

interface PlayerState {
  hidePlayer: boolean;
  setHidePlayer: (hide: boolean) => void;
}

// Create the Zustand store
export const usePlayerStore = create<PlayerState>((set) => ({
  hidePlayer: false, // initial state
  setHidePlayer: (hide) => set({ hidePlayer: hide }), // state updater
}));

interface MouseNoteState {
  Leftnote: string;
  Middlenote: string;
  Rightnote: string;
  setNotes: (notes: {
    Leftnote: string;
    Middlenote: string;
    Rightnote: string;
  }) => void;
  setLeftnote: (note: string) => void;
  setMiddlenote: (note: string) => void;
  setRightnote: (note: string) => void;
  resetNotes: () => void;
}

export const useMouseNoteStore = create<MouseNoteState>((set) => ({
  Leftnote: '',
  Middlenote: '',
  Rightnote: '',
  setNotes: (notes) => set(notes),
  setLeftnote: (note) => set({ Leftnote: note }),
  setMiddlenote: (note) => set({ Middlenote: note }),
  setRightnote: (note) => set({ Rightnote: note }),
  resetNotes: () =>
    set({ Leftnote: '', Middlenote: '', Rightnote: '' }),
}));
