package com.usoftchina.qywx.sdk.dto;

import java.util.*;

/**
 * @author yingp
 */
public class InviteReq {
    private Set<String> userSet;
    private Set<Integer> partySet;
    private Set<Integer> tagSet;

    public InviteReq user(String... userIds) {
        if (null == userSet) {
            userSet = new HashSet<>(userIds.length);
        }
        for (String userId : userIds) {
            userSet.add(userId);
        }
        return this;
    }

    public InviteReq party(Integer... partyIds) {
        if (null == partySet) {
            partySet = new HashSet<>(partyIds.length);
        }
        for (Integer partyId : partyIds) {
            partySet.add(partyId);
        }
        return this;
    }

    public InviteReq tag(Integer... tagIds) {
        if (null == tagSet) {
            tagSet = new HashSet<>(tagIds.length);
        }
        for (Integer tagId : tagIds) {
            tagSet.add(tagId);
        }
        return this;
    }

    public Map<String, Object> build() {
        Map<String, Object> data = new HashMap<>(1);
        if (null != userSet) {
            data.put("user", userSet);
        }
        if (null != partySet) {
            data.put("party", partySet);
        }
        if (null != tagSet) {
            data.put("tag", tagSet);
        }
        return data;
    }
}
