package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.AwardLedgerResp;
import com.ga.core.vo.commission.AwardLedgerSearchParam;
import com.ga.core.vo.commission.AwardLedgerVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * award_ledger Mapper — 시상 원장 (V92)
 */
@Mapper
public interface AwardLedgerMapper {

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

    List<AwardLedgerResp> selectList(AwardLedgerSearchParam param);

    /** 설계사 + 정산월 시상금 합계 */
    BigDecimal sumAwardByAgentAndMonth(@Param("agentId") Long agentId,
                                      @Param("settleMonth") String settleMonth);

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

    int insert(AwardLedgerVO vo);

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

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