package com.scm.contract.model.print;

import lombok.Data;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author zuo
 * @date 2024/6/26 14:36
 */
@Data
public class PrintTagSend {

    private String id;

    private String materialName;

    private String packageNumber;

    private String providerName;

    private List<String> qrCode;

    public PrintTagSend() {
    }

    public PrintTagSend(ReprintCode reprintCode, List<PrintCode> printCodes) {
        this.id = reprintCode.getId();
        this.materialName = reprintCode.getGoodsName();
        String unit = Objects.isNull(reprintCode.getMinimumPackingUnit())? "": reprintCode.getMinimumPackingUnit();
        this.packageNumber = reprintCode.getMinimumPackingNumber() + unit;
        this.providerName = printCodes.get(0).getProviderName();
        this.qrCode = printCodes.stream().map(PrintCode::getQrCode).collect(Collectors.toList());
    }
}
