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

import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerWarehouseCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerWarehouseUpdateCmd;
import com.xunhong.erp.turbo.biz.domain.entity.DealerWarehouse;
import com.xunhong.erp.turbo.biz.infrastructure.entity.DealerWarehouseDO;
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 DealerWarehouseConvert {

	@Mapping(target = "dealerPaymentAccount", source = "dealerPaymentAccountDO")
	@Mapping(target = "dealer", source = "dealerDO")
	DealerWarehouse toDealerWarehouse(DealerWarehouseDO dealerWarehouseDO);

	@Mapping(target = "dealerPaymentAccountDO", ignore = true)
	@Mapping(target = "dealerDO", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	DealerWarehouseDO toDealerWarehouseDO(DealerWarehouseCreateCmd dealerWarehouseCreateCmd);

	@Mapping(target = "dealerPaymentAccountDO", ignore = true)
	@Mapping(target = "dealerDO", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toDealerWarehouseDO(@MappingTarget DealerWarehouseDO dealerWarehouseDO, DealerWarehouseUpdateCmd dealerWarehouseUpdateCmd);
}

