package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.BranchMgrAllowanceRuleResp;
import com.ga.core.vo.commission.BranchMgrAllowanceRuleSearchParam;
import com.ga.core.vo.commission.BranchMgrAllowanceRuleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * branch_mgr_allowance_rule Mapper — 지점장수당 룰 (V94)
 */
@Mapper
public interface BranchMgrAllowanceRuleMapper {

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

    List<BranchMgrAllowanceRuleResp> selectList(BranchMgrAllowanceRuleSearchParam param);

    /**
     * 직책코드 + 기준일 유효 룰 1건 조회.
     * 지점장수당 계산 Service에서 호출.
     */
    BranchMgrAllowanceRuleVO selectActiveRule(@Param("positionCode") String positionCode,
                                             @Param("baseDate") LocalDate baseDate);

    int insert(BranchMgrAllowanceRuleVO vo);

    int update(BranchMgrAllowanceRuleVO vo);

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