package com.cool.store.dao.order;

import com.cool.store.entity.order.StoreWishlistOptionDO;
import com.cool.store.mapper.order.StoreWishlistOptionMapper;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.List;

@Repository
@RequiredArgsConstructor
public class StoreWishlistOptionDAO {

    private final StoreWishlistOptionMapper mapper;

    public boolean insertBatch(List<StoreWishlistOptionDO> list) {
        if (CollectionUtils.isEmpty(list)) {
            return false;
        }
        return mapper.insertBatch(list) > 0;
    }

    public boolean softDeleteByWishlistIds(List<Long> wishlistIds) {
        if (CollectionUtils.isEmpty(wishlistIds)) {
            return false;
        }
        return mapper.softDeleteByWishlistIds(wishlistIds) > 0;
    }

    public List<StoreWishlistOptionDO> listByWishlistIds(List<Long> wishlistIds) {
        if (CollectionUtils.isEmpty(wishlistIds)) {
            return Collections.emptyList();
        }
        return mapper.listByWishlistIds(wishlistIds);
    }
}
