package cn.stylefeng.workflow.instance.modular.manage.factory;

import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO;
import cn.stylefeng.workflow.instance.modular.manage.pojo.vo.PredictUserItem;

import java.util.ArrayList;
import java.util.List;

public class PredictUserItemFactory {

    public static List<PredictUserItem> createPredictUserItemList(List<SimpleUserDTO> simpleUserDTOList) {

        if (ObjectUtil.isEmpty(simpleUserDTOList)) {
            return new ArrayList<>();
        }

        List<PredictUserItem> predictUserItemList = new ArrayList<>();
        for (SimpleUserDTO simpleUserDTO : simpleUserDTOList) {
            PredictUserItem predictUserItem = new PredictUserItem();
            predictUserItem.setId(simpleUserDTO.getUserId());
            predictUserItem.setName(simpleUserDTO.getRealName());
            predictUserItem.setAvatarUrl(simpleUserDTO.getAvatarUrl());
            predictUserItemList.add(predictUserItem);
        }

        return predictUserItemList;
    }

}
