package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.ProductConversionRateResp;
import com.ga.core.vo.commission.ProductConversionRateSearchParam;
import com.ga.core.vo.commission.ProductConversionRateVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * product_conversion_rate Mapper — 상품별 환산율 마스터 (V91)
 */
@Mapper
public interface ProductConversionRateMapper {

    ProductConversionRateResp selectById(@Param("rateId") Long rateId);

    List<ProductConversionRateResp> selectList(ProductConversionRateSearchParam param);

    /**
     * 상품 + 기준일 유효 환산율 1건 조회.
     * 인정실적 계산 Service에서 호출.
     */
    ProductConversionRateVO selectActiveRate(@Param("productId") Long productId,
                                            @Param("baseDate") LocalDate baseDate);

    int insert(ProductConversionRateVO vo);

    int update(ProductConversionRateVO vo);

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