import { StateCreator } from 'zustand';

export interface TableState {
  searchValue: string;
}

export interface TableUISlice {
  searchValue: string;
  setSearchValue: (value: string) => void;
  resetSearchValue: () => void;
}

export const createTableUISlice: StateCreator<
  TableUISlice,
  [],
  [],
  TableUISlice
> = (set) => ({
  // Initial state
  searchValue: '',

  // Actions
  setSearchValue: (value) => set({ searchValue: value }),

  resetSearchValue: () => {
    return set({ searchValue: '' });
  },
});
