package com.smyhub.store.mengyastorebackendjava.repository;

import com.smyhub.store.mengyastorebackendjava.entity.Wishlist;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;

@Repository
public interface WishlistRepository extends JpaRepository<Wishlist, Long> {

    List<Wishlist> findByAccountId(String accountId);

    Optional<Wishlist> findByAccountIdAndProductId(String accountId, String productId);

    boolean existsByAccountIdAndProductId(String accountId, String productId);

    @Transactional
    void deleteByAccountIdAndProductId(String accountId, String productId);
}
