package com.bonus.canteen.core.cook.mapper;

import java.time.LocalDate;
import java.util.List;

import com.bonus.canteen.core.cook.domain.CookAppRecipe;
import com.bonus.canteen.core.cook.domain.CookRecipe;
import com.bonus.canteen.core.cook.dto.AllocRecipeStallDTO;
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
import com.bonus.canteen.core.cook.dto.StallAndRecipeBindDto;
import com.bonus.canteen.core.cook.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 菜品计划信息Mapper接口
 *
 * @author xsheng
 * @date 2025-05-25
 */
public interface CookRecipeMapper {
    /**
     * 查询菜品计划信息
     *
     * @param recipeId 菜品计划信息主键
     * @return 菜品计划信息
     */
    public CookRecipe selectCookRecipeByRecipeId(Long recipeId);

    public CookRecipe selectCookRecipeByRecipeName(String recipeName);

    /**
     * 查询菜品计划信息列表
     *
     * @param cookRecipe 菜品计划信息
     * @return 菜品计划信息集合
     */
    public List<CookRecipe> selectCookRecipeList(CookRecipe cookRecipe);

    public List<CookRecipe> selectRecipeListByRecipeIds(@Param("recipeIds") List<Long> recipeIds);

    public int getDishesCount4PointDates(Long recipeId);

    public int getDishesCount4Recycle(Long recipeId);

    List<CookRecipeDishesCountVO> getDishesCountByRecipeIds(@Param("recipeIds") List<Long> recipeIds);

    List<CookRecipeDetailVO> selectApplyDateListByRecipeId(@Param("applyDate") LocalDate applyDate, @Param("recipeIds") List<Long> recipeIds);

    List<CookRecipeDetailVO> selectRecipeDetailList(@Param("recipeId") Long recipeId, @Param("applyDate") LocalDate applyDate);

    List<CookRecipeDetailVO> getRecipeDetail(@Param("params") CookRecipeDetailDTO dto);

    List<CookRecipeDetailVO> selectTemplateDetailList(@Param("params") CookRecipeDetailDTO dto);

    /**
     * 新增菜品计划信息
     *
     * @param cookRecipeDTO 菜品计划信息
     * @return 结果
     */
    public int insertCookRecipe(CookRecipeDTO cookRecipeDTO);

    /**
     * 修改菜品计划信息
     *
     * @param cookRecipeDTO 菜品计划信息
     * @return 结果
     */
    public int updateCookRecipe(CookRecipeDTO cookRecipeDTO);

    List<Integer> getDeviceIdByDevice(@Param("canteenId")String canteenId, @Param("stallId")String stallId);

    List<String> getDeviceSnByIds(@Param("list") List<Integer> deviceInfoList);

    boolean checkIfAlreadyBind(CookAppRecipe appRecipe);

    List<Long> selectRecipeInSameShop(@Param("stallId") Long stallId, @Param("bindType") Integer bindType, @Param("mealLineId") Long mealLineId);

    void deleteBind(CookAppRecipe appRecipe);

    int insertBind(CookAppRecipe appRecipe);

    void updateRecipeByCanteenStallMeal(@Param("recipeId")Long recipeId, @Param("canteenId")Long canteenId,
                                        @Param("stallId")Long stallId, @Param("deviceIds")List<Integer> deviceIds);

    /**
     * 删除菜品计划信息
     *
     * @param recipeId 菜品计划信息主键
     * @return 结果
     */
    public int deleteCookRecipeByRecipeId(Long recipeId);

    /**
     * 批量删除菜品计划信息
     *
     * @param recipeIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCookRecipeByRecipeIds(Long[] recipeIds);

    List<CookRecipe> getCookRecipeByRecipeIds(@Param("recipeIds") List<Long> recipeIds);

    public List<AllocRecipeStallVO> selectCookRecipeListV2(AllocRecipeStallDTO content);

    //List<StallAndRecipeBindVO> selectRecipeByStallIdsAndBindType(@Param("stallIds") List<Long> stallIds, @Param("bindType") Integer bindType);

    List<StallAndRecipeBindDto> selectRecipeByStallIdsAndBindType(@Param("stallIds") List<Long> stallIds, @Param("bindType") Integer bindType);

    List<CookRecipeDateVO> selectTmpBetweenDateDetailList(@Param("recipeIds") List<Long> recipeIds, @Param("applyStartDate") LocalDate applyStartDate, @Param("applyEndDate") LocalDate applyEndDate);


    //List<CookRecipeDetailVO> selectTmpBetweenDateDetailList(@Param("recipeIds") List<Long> recipeIds, @Param("applyStartDate") LocalDate applyStartDate, @Param("applyEndDate") LocalDate applyEndDate);

}
