package com.hz.pm.api.meta.validate;

import com.ningdatech.basic.exception.BizException;
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum;
import com.hz.pm.api.meta.model.po.ReqDictionaryListPO;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * @author liuxinxin
 * @date 2022/7/21 下午6:15
 */
public class DictParamValidator {

    private DictParamValidator() {
    }

    public static void dictionaryRequestValidator(ReqDictionaryListPO req) {
        List<String> dictTypeList = req.getDictionaryTypeList();
        if (CollectionUtils.isNotEmpty(dictTypeList)) {
            for (String dictType : dictTypeList) {
                if (!ExpertDictTypeEnum.contains(dictType)) {
                    throw new BizException("无效的字典信息: " + dictType);
                }
            }
        }
    }

}
