import { createContext,useContext } from 'solid-js'
import { type CollectionImpl, type CollectionLike } from '@tanstack/solid-db'
import  type { ExtractPayload, Todo } from '@<@var(context.project.name)>/rpc';
export type TodoCollection = CollectionImpl<ExtractPayload<Todo>>
export const TodoCollectionContext = createContext<TodoCollection>()
export const useTodoCollection = () => {
  const col = useContext(TodoCollectionContext)
  if (col === undefined) {
    throw new Error("Todo collection has not been initialized")
  }
  return col;
}
