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


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

import java.util.List;

/**
 * @author liuxinxin
 * @date 2022/7/22 下午2:44
 */

public class TagListRequestValidator {

    private TagListRequestValidator() {
    }

    public static void tagListRequestValidator(ReqTagListPO request) {
        List<String> rootTagCodeList = request.getRootTagCodeList();
        if (CollectionUtils.isNotEmpty(rootTagCodeList)) {
            for (String rootTagCode : rootTagCodeList) {
                if (!ExpertTagEnum.contains(rootTagCode)) {
                    throw new BizException("Illegal rootTagCode：" + rootTagCode);
                }
            }
        }
    }
}
