import { WishlistItemModel } from "@/lib/types/models/wishlist";
import { create } from "zustand";

type WishlistState = {
  wishList: WishlistItemModel[];
  isLoading: boolean;
  error: string | null;
};

type WishlistActions = {
  setWishlist: (data: WishlistItemModel[]) => void;
  setLoading: (loading: boolean) => void;
  setError: (error: string | null) => void;
};

export const useWishlistStore = create<WishlistState & WishlistActions>(
  (set) => ({
    // Initial state
    wishList: [],
    isLoading: false,
    error: null,

    // Actions
    setWishlist: (data) => set({ wishList: data }),
    setLoading: (loading) => set({ isLoading: loading }),
    setError: (error) => set({ error }),
  })
);
