package com.xunhong.erp.turbo.biz.infrastructure.convert;

import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerUpdateCmd;
import com.xunhong.erp.turbo.biz.domain.entity.Dealer;
import com.xunhong.erp.turbo.biz.infrastructure.entity.DealerDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValueCheckStrategy;

/**
 * @author shenyifei
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface DealerConvert {

	@Mapping(target = "dealerPaymentAccountList", source = "dealerPaymentAccountDOList")
	Dealer toDealer(DealerDO dealerDO);

	@Mapping(target = "sort", ignore = true)
	@Mapping(target = "deliveryTemplate", ignore = true)
	@Mapping(target = "dealerPaymentAccountDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	DealerDO toDealerDO(DealerCreateCmd dealerCreateCmd);

	@Mapping(target = "sort", ignore = true)
	@Mapping(target = "dealerPaymentAccountDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toDealerDO(@MappingTarget DealerDO dealerDO, DealerUpdateCmd dealerUpdateCmd);
}
