package com.jwipc.order.convert;

import com.jwipc.order.dto.PurchaseOrderDetailLabelPrintDTO;
import com.jwipc.order.dto.PurchaseOrderDetailListDTO;
import com.jwipc.order.dto.PurchaseOrderItemPrintDTO;
import com.jwipc.order.entity.PurchaseOrderDetail;
import com.jwipc.order.model.po.PurchaseOrderDetailPO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;

import java.util.List;


@Mapper(componentModel = "spring")
public interface PurchaseOrderDetailConvert {
    List<PurchaseOrderDetailListDTO> entities2Dtos(List<PurchaseOrderDetail> list);

    List<PurchaseOrderDetailListDTO> pos2Dtos(List<PurchaseOrderDetailPO> list);

    PurchaseOrderItemPrintDTO entity2Dto(PurchaseOrderDetail purchaseOrderDetail);

    @Mappings({
            @Mapping(target = "materialType",source = "middleClass"),
            @Mapping(target = "unit",source = "unitCode"),
    })

    PurchaseOrderDetailLabelPrintDTO entity2Dto1(PurchaseOrderDetail one);

    PurchaseOrderDetail fill(PurchaseOrderDetail dbDetail,@MappingTarget PurchaseOrderDetail purchaseOrderDetail);
}
