package incheon.ags.mrb.share.mapper;


import incheon.ags.mrb.share.vo.RecipeShrnVO;
import incheon.com.config.annotation.MainDB;

import java.util.List;

/**
 * 레시피 공유 매퍼 인터페이스
 * - 레시피 공유 요청 및 승인 관리
 */
@org.egovframe.rte.psl.dataaccess.mapper.Mapper @incheon.com.config.annotation.MainDB public interface RecipeShrnMapper {

    /**
     * 레시피 공유 목록 조회 (총 건수 포함)
     * @param recipeShrnVO 검색 조건
     * @return 레시피 공유 목록 (각 VO에 totalCount 포함)
     * @throws Exception
     */
    List<RecipeShrnVO> selectRecipeShrnList(RecipeShrnVO recipeShrnVO);

    /**
     * 레시피 공유 상세 조회
     * @param shrnId 공유 ID
     * @return 레시피 공유 상세 정보
     * @throws Exception
     */
    RecipeShrnVO selectRecipeShrnDetail(Integer shrnId);

    /**
     * 레시피별 공유 목록 조회
     * @param recipeId 레시피 ID
     * @return 해당 레시피의 공유 목록
     * @throws Exception
     */
    List<RecipeShrnVO> selectRecipeShrnListByRecipeId(Integer recipeId);

    /**
     * 레시피 공유 요청 등록
     * @param recipeShrnVO 레시피 공유 정보
     * @throws Exception
     */
    void insertRecipeShrn(RecipeShrnVO recipeShrnVO);

    /**
     * 레시피 공유 승인 상태 수정
     * @param recipeShrnVO 레시피 공유 정보 (shrnId, aprvStts 필수)
     * @throws Exception
     */
    void updateRecipeShrnStatus(RecipeShrnVO recipeShrnVO);

    /**
     * 레시피 공유 요청 삭제
     * @param shrnId 공유 ID
     * @throws Exception
     */
    void deleteRecipeShrn(Integer shrnId);

    /**
     * 레시피별 공유 요청 삭제 (레시피 삭제 시)
     * @param recipeId 레시피 ID
     * @throws Exception
     */
    void deleteRecipeShrnByRecipeId(Integer recipeId);

    /**
     * 레시피 공유 요청 중복 확인
     * @param recipeShrnVO 레시피 공유 정보 (recipeId 필수)
     * @return 동일한 레시피의 대기 중인 공유 요청 개수
     * @throws Exception
     */
    int checkRecipeShrnExists(RecipeShrnVO recipeShrnVO);

    /**
     * 레시피별 공유수 조회 (승인 완료된 공유 대상자 수)
     * @param recipeId 레시피 ID
     * @return 공유 대상자 수
     * @throws Exception
     */
    int selectRecipeShareCount(Integer recipeId);
}

