package com.galaxis.manatee.configuration;

import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zcj
 * @version 0.1
 * @date 2020/1/9 4:52 下午
 */
@Configuration
public class DingTalkConfiguration {

    /**
     * 获取审批列表的URL
     */
    @Value("${dingTalk.processUrl.listIds}")
    private String processUrlListId;

    /**
     * 获取审批实例
     */
    @Value(("${dingTalk.processUrl.instance}"))
    private String processUrlInstance;

    /**
     * 获取审批列表Id的客户端
     * @return  客户端
     */
    @Bean
    public DingTalkClient processInstanceListIdsClient(){
        return new DefaultDingTalkClient(processUrlListId);
    }

    /**
     * 获取审批内容客户端
     * @return  客户端
     */
    @Bean
    public DingTalkClient processInstanceClient(){
        return new DefaultDingTalkClient(processUrlInstance);
    }
}
