import { create } from "zustand";

interface SearchState {
    isOpen: boolean;
    query: string;
    setOpen: (open: boolean) => void;
    setQuery: (query: string) => void;
    openSearchWithTag: (tag: string) => void;
}

export const useSearchStore = create<SearchState>((set) => ({
    isOpen: false,
    query: "",
    setOpen: (isOpen) => set({ isOpen }),
    setQuery: (query) => set({ query }),
    openSearchWithTag: (tag) => set({ isOpen: true, query: `tag:${tag}` }),
}));
