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

import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderGenerateDocumentCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderUpdateCmd;
import com.xunhong.erp.turbo.biz.domain.entity.ShipOrder;
import com.xunhong.erp.turbo.biz.infrastructure.entity.ShipOrderDO;
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 ShipOrderConvert {

	@Mapping(target = "orderCostList", source = "orderCostDOList")
	@Mapping(target = "shipOrderPackageList", source = "shipOrderPackageDOList")
	@Mapping(target = "shipOrderItemList", source = "shipOrderItemDOList")
	ShipOrder toShipOrder(ShipOrderDO shipOrderDO);

	@Mapping(target = "orderCostDOList", ignore = true)
	@Mapping(target = "warehouseName", ignore = true)
	@Mapping(target = "warehouseId", ignore = true)
	@Mapping(target = "vehicleNo", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "shipDocument", ignore = true)
	@Mapping(target = "purchaseDocument", ignore = true)
	@Mapping(target = "dealerName", ignore = true)
	@Mapping(target = "dealerId", ignore = true)
	@Mapping(target = "costDocument", ignore = true)
	@Mapping(target = "shipOrderPackageDOList", ignore = true)
	@Mapping(target = "shipOrderItemDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	ShipOrderDO toShipOrderDO(ShipOrderCreateCmd shipOrderCreateCmd);

	@Mapping(target = "orderCostDOList", ignore = true)
	@Mapping(target = "warehouseName", ignore = true)
	@Mapping(target = "warehouseId", ignore = true)
	@Mapping(target = "vehicleNo", ignore = true)
	@Mapping(target = "trademarkFee", ignore = true)
	@Mapping(target = "totalAmount", ignore = true)
	@Mapping(target = "strawMatDebt", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "shippingDate", ignore = true)
	@Mapping(target = "receivingAddress", ignore = true)
	@Mapping(target = "purchaseOrderId", ignore = true)
	@Mapping(target = "provisionFee", ignore = true)
	@Mapping(target = "orderSn", ignore = true)
	@Mapping(target = "licensePlate", ignore = true)
	@Mapping(target = "laborFee", ignore = true)
	@Mapping(target = "freightDebt", ignore = true)
	@Mapping(target = "farmerInfo", ignore = true)
	@Mapping(target = "driverPhone", ignore = true)
	@Mapping(target = "driverName", ignore = true)
	@Mapping(target = "dealerName", ignore = true)
	@Mapping(target = "dealerId", ignore = true)
	@Mapping(target = "codingFee", ignore = true)
	@Mapping(target = "cartonFee", ignore = true)
	@Mapping(target = "shipOrderPackageDOList", ignore = true)
	@Mapping(target = "shipOrderItemDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toShipOrderDO(@MappingTarget ShipOrderDO shipOrderDO, ShipOrderUpdateCmd shipOrderUpdateCmd);

	@Mapping(target = "orderCostDOList", ignore = true)
	@Mapping(target = "companyName", ignore = true)
	@Mapping(target = "companyId", ignore = true)
	@Mapping(target = "warehouseName", ignore = true)
	@Mapping(target = "warehouseId", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "vehicleNo", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "trademarkFee", ignore = true)
	@Mapping(target = "totalAmount", ignore = true)
	@Mapping(target = "strawMatDebt", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "shippingDate", ignore = true)
	@Mapping(target = "shipOrderPackageDOList", ignore = true)
	@Mapping(target = "shipOrderItemDOList", ignore = true)
	@Mapping(target = "receivingAddress", ignore = true)
	@Mapping(target = "purchaseOrderId", ignore = true)
	@Mapping(target = "provisionFee", ignore = true)
	@Mapping(target = "orderSn", ignore = true)
	@Mapping(target = "licensePlate", ignore = true)
	@Mapping(target = "laborFee", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "freightDebt", ignore = true)
	@Mapping(target = "farmerInfo", ignore = true)
	@Mapping(target = "driverPhone", ignore = true)
	@Mapping(target = "driverName", ignore = true)
	@Mapping(target = "dealerName", ignore = true)
	@Mapping(target = "dealerId", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	@Mapping(target = "codingFee", ignore = true)
	@Mapping(target = "cartonFee", ignore = true)
	void toShipOrderDO(@MappingTarget ShipOrderDO shipOrderDO, ShipOrderGenerateDocumentCmd shipOrderGenerateDocumentCmd);
}

