package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.LifeSupportRuleResp;
import com.ga.core.vo.commission.LifeSupportRuleSearchParam;
import com.ga.core.vo.commission.LifeSupportRuleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * life_support_rule Mapper — 생보운영지원수수료 룰 (V93)
 */
@Mapper
public interface LifeSupportRuleMapper {

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

    List<LifeSupportRuleResp> selectList(LifeSupportRuleSearchParam param);

    /**
     * 설계사 등급 + 기준일 유효 룰 1건 조회.
     * 생보운영지원수수료 계산 Service에서 호출.
     */
    LifeSupportRuleVO selectActiveRule(@Param("agentGrade") String agentGrade,
                                     @Param("baseDate") LocalDate baseDate);

    int insert(LifeSupportRuleVO vo);

    int update(LifeSupportRuleVO vo);

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