package com.jeequan.jeepay.converter;

import com.jeequan.jeepay.core.entity.TransferOrder;
import com.jeequan.jeepay.core.entity.TransferWallet;
import com.jeequan.jeepay.db.entity.TransferOrderEntity;
import com.jeequan.jeepay.db.entity.TransferWalletEntity;
import org.mapstruct.*;

/**
 * 代付相关实体类转换器
 *
 * @author deng
 * @since 2024/5/9
 */
@Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface TransferConverter {

    @BeanMapping(builder = @Builder(disableBuilder = true))
    TransferOrder toModel(TransferOrderEntity entity);

    @Mapping(target = "ext", ignore = true)
    @Mapping(target = "dateRange", ignore = true)
    @BeanMapping(builder = @Builder(disableBuilder = true))
    TransferOrderEntity toDbEntity(TransferOrder model);

    @BeanMapping(builder = @Builder(disableBuilder = true))
    TransferWallet toModel(TransferWalletEntity entity);

    @BeanMapping(builder = @Builder(disableBuilder = true))
    TransferWalletEntity toDbEntity(TransferWallet entity);
}
