'use client';

import { Product } from '@/domain/entities';
import { container } from '@/application/container';
import { useWishlistStore } from '@/infrastructure/persistence/zustand/wishlistStore';

export function useWishlist() {
  const items = useWishlistStore((s) => s.items);

  return {
    items,
    isInWishlist: (productId: string) =>
      container.wishlistRepository.isInWishlist(productId),
    toggleItem: (product: Product) =>
      container.toggleWishlist.execute(product),
    removeItem: (productId: string) =>
      container.wishlistRepository.removeItem(productId),
  };
}