package com.ningdatech.pmapi.meta.validate;

import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * @author liuxinxin
 * @date 2022/7/21 下午6:15
 */

public class DictionaryRequestValidator {

    public static void dictionaryRequestValidator(ReqDictionaryListPO reqDictionaryListPO) {
        List<String> dictionaryTypeList = reqDictionaryListPO.getDictionaryTypeList();
        if (CollectionUtils.isNotEmpty(dictionaryTypeList)) {
            for (String dictionaryType : dictionaryTypeList) {
                if (!DictExpertInfoTypeEnum.contains(dictionaryType)) {
                    throw new BizException("Illegal dictionaryType: " + dictionaryType);
                }
            }
        }
    }
}
