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

import com.xunhong.erp.turbo.api.biz.dto.cmd.OrderSupplierUpdateCmd;
import com.xunhong.erp.turbo.biz.domain.entity.OrderSupplier;
import com.xunhong.erp.turbo.biz.domain.entity.PurchaseOrder;
import com.xunhong.erp.turbo.biz.infrastructure.entity.OrderSupplierDO;
import com.xunhong.erp.turbo.biz.infrastructure.entity.PurchaseOrderDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValueCheckStrategy;


/**
 * @author shenyifei
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS, uses = {OrderPackageConvert.class})
public interface OrderSupplierConvert {

	@Mapping(target = "purchaseOrder", source = "purchaseOrderDO")
	@Mapping(target = "orderCompany", source = "orderCompanyDO")
	@Mapping(target = "orderPackageList", source = "orderPackageDOList")
	OrderSupplier toOrderSupplier(OrderSupplierDO orderSupplierDO);

	@Mapping(target = "orderSupplierList", ignore = true)
	@Mapping(target = "orderShipList", ignore = true)
	@Mapping(target = "orderRebate", ignore = true)
	@Mapping(target = "orderPackageList", ignore = true)
	@Mapping(target = "orderDealer", ignore = true)
	@Mapping(target = "orderCostList", ignore = true)
	@Mapping(target = "orderCostItemList", ignore = true)
	@Mapping(target = "orderCompany", ignore = true)
	@Mapping(target = "orderVehicle", source = "orderVehicleDO")
	PurchaseOrder toPurchaseOrder(PurchaseOrderDO purchaseOrderDO);

	@Mapping(target = "purchaseOrderDO", ignore = true)
	@Mapping(target = "pricingMethod", ignore = true)
	@Mapping(target = "poState", ignore = true)
	@Mapping(target = "packageUsage", ignore = true)
	@Mapping(target = "orderCompanyDO", ignore = true)
	@Mapping(target = "costTemplate", ignore = true)
	@Mapping(target = "costIds", ignore = true)
	@Mapping(target = "wechatQr", ignore = true)
	@Mapping(target = "totalWeightImg", ignore = true)
	@Mapping(target = "totalWeight", ignore = true)
	@Mapping(target = "supplierId", ignore = true)
	@Mapping(target = "salePrice", ignore = true)
	@Mapping(target = "purchasePrice", ignore = true)
	@Mapping(target = "productName", ignore = true)
	@Mapping(target = "productId", ignore = true)
	@Mapping(target = "phone", ignore = true)
	@Mapping(target = "orderId", ignore = true)
	@Mapping(target = "netWeight", ignore = true)
	@Mapping(target = "name", ignore = true)
	@Mapping(target = "isPaper", ignore = true)
	@Mapping(target = "isLast", ignore = true)
	@Mapping(target = "invoiceAmount", ignore = true)
	@Mapping(target = "idCard", ignore = true)
	@Mapping(target = "grossWeight", ignore = true)
	@Mapping(target = "emptyWeightImg", ignore = true)
	@Mapping(target = "emptyWeight", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	@Mapping(target = "bankCard", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "orderPackageDOList", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "isDepositPaid", ignore = true)
	@Mapping(target = "depositAmount", ignore = true)
	void toOrderSupplierDO(@MappingTarget OrderSupplierDO orderSupplierDO, OrderSupplierUpdateCmd orderSupplierUpdateCmd);
}
