package com.ningdatech.pmapi.meta.validate;


import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum;
import com.ningdatech.pmapi.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);
                }
            }
        }
    }
}
