package com.usoftchina.qywx.sdk.dto;

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

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

    private final CheckinType type;
    private final long startTime;
    private final long endTime;
    private final List<String> userList;

    public GetCheckinDataReq(CheckinType type, long startTime, long endTime, List<String> userList) {
        this.type = type;
        this.startTime = startTime;
        this.endTime = endTime;
        this.userList = userList;
    }

    public Map<String, Object> build() {
        Map<String, Object> data = new HashMap<>(4);
        data.put("opencheckindatatype", type.code);
        data.put("starttime", startTime);
        data.put("endtime", endTime);
        data.put("useridlist", userList);
        return data;
    }

    /**
     * 打卡类型
     */
    public enum CheckinType {
        /**
         * 上下班
         */
        COMMUTE(1),
        /**
         * 外出
         */
        OUT(2),
        /**
         * 全部
         */
        ALL(3);
        private final int code;

        CheckinType(int code) {
            this.code = code;
        }
    }
}
