package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.CollectionCommissionRuleResp;
import com.ga.core.vo.commission.CollectionCommissionRuleSearchParam;
import com.ga.core.vo.commission.CollectionCommissionRuleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * collection_commission_rule Mapper.
 */
@Mapper
public interface CollectionCommissionRuleMapper {

    CollectionCommissionRuleResp selectById(@Param("ruleId") Long ruleId);

    List<CollectionCommissionRuleResp> selectList(CollectionCommissionRuleSearchParam param);

    /**
     * 상품 + 납입주기 + 기준일 기준 유효 룰 1건 조회.
     * 수금수수료 계산 배치에서 호출.
     */
    CollectionCommissionRuleVO selectActiveRule(@Param("productId") Long productId,
                                               @Param("paymentCycle") String paymentCycle,
                                               @Param("baseDate") LocalDate baseDate);

    int insert(CollectionCommissionRuleVO vo);

    int update(CollectionCommissionRuleVO vo);

    int delete(@Param("ruleId") Long ruleId);
}
