package net.yyc.common.qcc.entity;


import net.yyc.common.qcc.config.QccConfig;
import lombok.Data;
import org.apache.commons.codec.digest.DigestUtils;

import java.util.Map;

@Data
public class EmployeeGetListRequest extends CommonRequest {

	private static final String PATH = "http://api.qichacha.com/ECIEmployee/GetList";


	public static EmployeeGetListRequest from(Map<String, String> params, QccConfig config) {
		EmployeeGetListRequest request = new EmployeeGetListRequest();
		params.put("key", config.getAppKey());
		String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
		request.timestamp = timestamp;
		request.token = DigestUtils.md5Hex(config.getAppKey().concat(timestamp).concat(config.getSecretKey())).toUpperCase();
		request.queryUrl = PATH;
		request.params = params;
		return request;
	}
}
