package com.trade.service;

import com.trade.service.credit.domain.BizCreditApply;
import com.trade.service.credit.domain.vo.BizCreditApplyVO;
import com.trade.service.order.domain.PurchaseOrderCommodity;
import com.trade.service.order.dto.PurchaseOrderCommodityTL;
import com.trade.service.sales.domain.ContractTerms;
import com.trade.service.salesorder.domain.SalesOrder;
import com.trade.service.salesorder.domain.SalesOrderGoods;
import com.trade.service.salesorder.domain.SalesOrderLogistics;
import com.trade.service.salesorder.dto.GoodsInfo4TL;
import com.trade.service.salesorder.dto.SalesOrderDeliverDTO;
import com.trade.service.salesorder.vo.SalesOrderPayInfoVO;
import com.trade.service.salesorder.vo.SalesOrderVO;
import org.mapstruct.*;

import java.util.List;

@Mapper
public interface TransStruct {

    BizCreditApply vO2BizCreditApply(BizCreditApplyVO bizCreditApplyVO);

    @IterableMapping(qualifiedByName = "transSalesOrder2GoodsInfo4TL")
    List<GoodsInfo4TL> transOrder2GoodsInfo4TLList(List<SalesOrderGoods> salesOrderGoodsList);

    SalesOrderLogistics transOrderDeliver2OrderLogistics(SalesOrderDeliverDTO orderDeliverDTO);

    @Mappings({
            @Mapping(source = "price", target = "unitPrice"),
            @Mapping(source = "packingSpecifications", target = "packages"),
            @Mapping(source = "name", target = "goodsName"), @Mapping(source = "priceTotal", target = "amount")
    })
    @Named("transSalesOrder2GoodsInfo4TL")
    GoodsInfo4TL transSalesOrder2GoodsInfo4TL(SalesOrderGoods salesOrderGoods);

    SalesOrderVO transSalesOrder2SalesOrderVO(SalesOrder salesOrder);

    SalesOrderPayInfoVO transContractTerms2SalesOrderPayInfoVO(ContractTerms contractTerms);

    List<PurchaseOrderCommodityTL> transPurchaseOrderCommodityForTLList(List<PurchaseOrderCommodity> commodities);
}
