package com.njcn.bpm.strategy;

import com.njcn.bpm.enums.BpmTaskCandidateStrategyEnum;
import com.njcn.bpm.utils.StrUtils;
import com.njcn.user.api.UserFeignClient;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户 {@link IBpmTaskCandidateStrategy} 实现类
 *
 * @author kyle
 */
@Component
public class BpmTaskCandidateUserStrategy implements IBpmTaskCandidateStrategy {

    @Resource
    private UserFeignClient adminUserApi;

    @Override
    public BpmTaskCandidateStrategyEnum getStrategy() {
        return BpmTaskCandidateStrategyEnum.USER;
    }

    @Override
    public void validateParam(String param) {
//        adminUserApi.validateUserList(StrUtils.splitToLongSet(param));
        //暂时默认均有效，后期可以加强管理，todo...
    }

    @Override
    public List<String> calculateUsers(DelegateExecution execution, String param) {
        return StrUtils.splitToStringList(param);
    }

}