package com.jeesharp.business.modules.food.service;

import com.jeesharp.business.modules.food.entity.FoodPackage;
import com.jeesharp.business.modules.food.vo.FoodPackageQueryVO;
import com.jeesharp.framework.mybatis.core.service.BaseInterface;

import java.util.List;
import java.util.Map;

/**
 * 美食套餐领域服务接口。
 *
 * @author jeesharp
 * @since 2026-06-04
 */
public interface FoodPackageService extends BaseInterface<FoodPackage, FoodPackageQueryVO> {

    List<FoodPackage> listOnlineByRestaurant(String restaurantId);

    void createPackage(FoodPackage entity);

    void updatePackage(FoodPackage entity);
/**
     * 按套餐名称模糊匹配，返回套餐主键列表。
     */
    List<String> findIdsByNameLike(String name);

    /**
     * 批量获取套餐名称。
     */
    Map<String, String> mapPackageNameByIds(List<String> ids);

    Map<String, FoodPackage> mapPackageByIds(List<String> ids);

    /**
     * 若套餐配置了可售库存则原子扣减；失败抛业务异常。
     */
    void decrementAvailableQuantityIfConfigured(FoodPackage pkg, int quantity);
}
