package com.usoftchina.qywx.sdk.dto;

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

/**
 * @author yingp
 */
public class BatchUpdateInvoiceStatusReq {
    /**
     * 用户openid，可用“userid与openid互换接口”获取
     */
    private String openId;
    /**
     * 发票报销状态 INVOICE_REIMBURSE_INIT：发票初始状态，未锁定；INVOICE_REIMBURSE_LOCK：发票已锁定，无法重复提交报销;INVOICE_REIMBURSE_CLOSURE:发票已核销，从用户卡包中移除
     */
    private InvoiceStatus status;
    private List<Invoice> invoices;

    public BatchUpdateInvoiceStatusReq(String openId, InvoiceStatus status, List<Invoice> invoices) {
        this.openId = openId;
        this.status = status;
        this.invoices = invoices;
    }

    public Map<String, Object> build() {
        Map<String, Object> data = new HashMap<>(3);
        data.put("openid", openId);
        data.put("reimburse_status", status.name());
        data.put("invoice_list", invoices);
        return data;
    }

    public static class Invoice {
        /**
         * 发票卡券的card_id
         */
        private String cardId;
        /**
         * 发票卡券的加密code，和card_id共同构成一张发票卡券的唯一标识
         */
        private String encryptCode;

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