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

import com.xunhong.erp.turbo.api.biz.dto.cmd.OrderShipCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.OrderShipGenerateDocumentCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.OrderShipUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.common.OrderShip;
import com.xunhong.erp.turbo.biz.infrastructure.entity.OrderShipDO;
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 OrderShipConvert {

	@Mapping(target = "orderVehicle", source = "orderVehicleDO")
	@Mapping(target = "orderCostList", source = "orderCostDOList")
	@Mapping(target = "orderShipItemList", source = "orderShipItemDOList")
	com.xunhong.erp.turbo.biz.domain.entity.OrderShip toOrderShip(OrderShipDO orderShipDO);

	@Mapping(target = "orderVehicleDO", ignore = true)
	@Mapping(target = "orderCostDOList", ignore = true)
	@Mapping(target = "warehouseName", ignore = true)
	@Mapping(target = "warehouseId", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "document", ignore = true)
	@Mapping(target = "orderShipItemDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	OrderShipDO toOrderShipDO(OrderShipCreateCmd orderShipCreateCmd);

	@Mapping(target = "orderVehicleDO", ignore = true)
	@Mapping(target = "orderId", ignore = true)
	@Mapping(target = "orderCostDOList", ignore = true)
	@Mapping(target = "warehouseName", ignore = true)
	@Mapping(target = "warehouseId", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "shippingDate", ignore = true)
	@Mapping(target = "receivingAddress", ignore = true)
	@Mapping(target = "orderSn", ignore = true)
	@Mapping(target = "farmerInfo", ignore = true)
	@Mapping(target = "orderShipItemDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toOrderShipDO(@MappingTarget OrderShipDO orderShipDO, OrderShipUpdateCmd orderShipUpdateCmd);

	@Mapping(target = "orderVehicleDO", ignore = true)
	@Mapping(target = "orderId", ignore = true)
	@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 = "updatedAt", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "shippingDate", ignore = true)
	@Mapping(target = "orderShipItemDOList", ignore = true)
	@Mapping(target = "receivingAddress", ignore = true)
	@Mapping(target = "orderSn", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "farmerInfo", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toOrderShipDO(@MappingTarget OrderShipDO orderShipDO, OrderShipGenerateDocumentCmd orderShipGenerateDocumentCmd);

	@Mapping(target = "orderVehicleDO", ignore = true)
	@Mapping(target = "orderCostDOList", ignore = true)
	@Mapping(target = "orderShipItemDOList", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	@Mapping(target = "farmerInfo", ignore = true)
	OrderShipDO toOrderShipDO(OrderShip orderShip);
}

