package com.ga.core.mapstruct;

import com.ga.core.vo.commission.ClawbackReceivableSaveReq;
import com.ga.core.vo.commission.ClawbackReceivableVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

/**
 * ClawbackReceivable SaveReq → VO 변환.
 * write-off API: Service 에서 req→VO 후 writeOff Mapper 호출.
 */
@Mapper(componentModel = "spring")
public interface ClawbackReceivableMapStruct {

    @Mapping(target = "receivableId",      ignore = true)
    @Mapping(target = "agentId",           ignore = true)
    @Mapping(target = "originSettleMonth", ignore = true)
    @Mapping(target = "originalAmount",    ignore = true)
    @Mapping(target = "recoveredAmount",   ignore = true)
    @Mapping(target = "balance",           ignore = true)
    @Mapping(target = "lastRecoveryMonth", ignore = true)
    @Mapping(target = "writtenOffAt",      ignore = true)
    @Mapping(target = "writtenOffBy",      ignore = true)
    @Mapping(target = "createdAt",         ignore = true)
    @Mapping(target = "createdBy",         ignore = true)
    @Mapping(target = "updatedAt",         ignore = true)
    ClawbackReceivableVO toVO(ClawbackReceivableSaveReq req);

    @Mapping(target = "receivableId",      ignore = true)
    @Mapping(target = "agentId",           ignore = true)
    @Mapping(target = "originSettleMonth", ignore = true)
    @Mapping(target = "originalAmount",    ignore = true)
    @Mapping(target = "recoveredAmount",   ignore = true)
    @Mapping(target = "balance",           ignore = true)
    @Mapping(target = "lastRecoveryMonth", ignore = true)
    @Mapping(target = "writtenOffAt",      ignore = true)
    @Mapping(target = "writtenOffBy",      ignore = true)
    @Mapping(target = "createdAt",         ignore = true)
    @Mapping(target = "createdBy",         ignore = true)
    @Mapping(target = "updatedAt",         ignore = true)
    void updateVO(ClawbackReceivableSaveReq req, @MappingTarget ClawbackReceivableVO vo);
}
