package com.usoftchina.qywx.sdk.dto;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author yingp
 */
public class BatchGetInvoiceInfoReq {

    private List<Invoice> invoices;

    public BatchGetInvoiceInfoReq(List<Invoice> invoices) {
        this.invoices = invoices;
    }

    public Map<String, Object> build() {
        Map<String, Object> data = new HashMap<>(1);
        data.put("item_list", invoices.stream().map(Invoice::build).collect(Collectors.toList()));
        return data;
    }

    public static class Invoice {
        private String cardId;
        private String encryptCode;

        public Invoice(String cardId, String encryptCode) {
            this.cardId = cardId;
            this.encryptCode = encryptCode;
        }

        public Map<String, Object> build() {
            Map<String, Object> data = new HashMap<>(1);
            data.put("card_id", cardId);
            data.put("encrypt_code", encryptCode);
            return data;
        }
    }
}
