package com.ga.core.mapper.ledger;

import com.ga.core.vo.ledger.ExceptionLedgerResp;
import com.ga.core.vo.ledger.ExceptionLedgerVO;
import com.ga.core.vo.ledger.LedgerSearchParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface ExceptionLedgerMapper {
    List<ExceptionLedgerResp> selectList(LedgerSearchParam param);
    ExceptionLedgerResp selectDetailById(@Param("ledgerId") Long ledgerId);
    ExceptionLedgerVO selectById(@Param("ledgerId") Long ledgerId);
    int insert(ExceptionLedgerVO vo);
    int update(ExceptionLedgerVO vo);
    int updateApprove(@Param("ledgerId") Long ledgerId,
                      @Param("status") String status,
                      @Param("approverId") Long approverId);
    int decrementRecurring(@Param("ledgerId") Long ledgerId);

    /** 정산월별 PLUS/MINUS 합계 */
    List<Map<String, Object>> aggregateByAgent(@Param("settleMonth") String settleMonth);
    BigDecimal sumPlusByMonth(@Param("settleMonth") String settleMonth);
    BigDecimal sumMinusByMonth(@Param("settleMonth") String settleMonth);
}
