package com.imdroid.beidou.data.dto;

import com.google.gson.annotations.Expose;
import com.imdroid.beidou.utils.GsonUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

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

/**
 * 小程序订阅消息
 *
 * @author LiGang
 * @date 2023/11/11 16:09
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class MiniSubscribeMessageDTO {

    @Expose
    private String touser;

    @Expose
    private String template_id;

    @Expose
    private String page;

    @Expose
    private String miniprogram_state = "developer";

    @Expose
    private String lang = "zh_CN";

    @Expose
    private Map<String, Map<String, Object>> data;


    public void addDataItem(String key, Object value) {
        if (data == null) {
            data = new HashMap<>(8);
        }
        Map<String, Object> valueMap = new HashMap<>(1);
        valueMap.put("value", value);
        data.put(key, valueMap);
    }

    public void removeDataItem(String key) {
        data.remove(key);
    }
}
