package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.SettlingSupportRuleResp;
import com.ga.core.vo.commission.SettlingSupportRuleSearchParam;
import com.ga.core.vo.commission.SettlingSupportRuleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * settling_support_rule Mapper — 정착지원금 룰 (V90)
 */
@Mapper
public interface SettlingSupportRuleMapper {

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

    List<SettlingSupportRuleResp> selectList(SettlingSupportRuleSearchParam param);

    /**
     * 설계사 등급 + 기준일 유효 룰 1건 조회.
     * 정착지원금 계산 Service에서 호출.
     */
    SettlingSupportRuleVO selectActiveRule(@Param("agentGrade") String agentGrade,
                                         @Param("baseDate") LocalDate baseDate);

    int insert(SettlingSupportRuleVO vo);

    int update(SettlingSupportRuleVO vo);

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