package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.SettlingSupportLedgerResp;
import com.ga.core.vo.commission.SettlingSupportLedgerSearchParam;
import com.ga.core.vo.commission.SettlingSupportLedgerVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * settling_support_ledger Mapper — 정착지원금 원장 (V90)
 */
@Mapper
public interface SettlingSupportLedgerMapper {

    SettlingSupportLedgerResp selectById(@Param("ledgerId") Long ledgerId);

    List<SettlingSupportLedgerResp> selectList(SettlingSupportLedgerSearchParam param);

    /** 설계사 + 정산월 실지급액 합계 */
    BigDecimal sumNetByAgentAndMonth(@Param("agentId") Long agentId,
                                    @Param("settleMonth") String settleMonth);

    /** 정산월 기준 설계사별 합계 — settle_master 집계 배치 용도 */
    List<Map<String, Object>> aggregateByAgent(@Param("settleMonth") String settleMonth);

    int insert(SettlingSupportLedgerVO vo);

    int updateStatus(@Param("ledgerId") Long ledgerId, @Param("status") String status);

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