package cn.reghao.tnb.content.app.exam.model.provider;

import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
//import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;

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

/**
 * @author reghao
 * @date 2024-09-01 10:13:47
 */
public class QuestionAddGroupSequenceProvider /*implements DefaultGroupSequenceProvider<QuestionAddDto>*/ {
    //@Override
    public List<Class<?>> getValidationGroups(QuestionAddDto questionAddDto) {
        List<Class<?>> defaultGroupSequence = new ArrayList<>();
        defaultGroupSequence.add(QuestionAddDto.class);

        if (questionAddDto != null) {
            int questionType = questionAddDto.getQuestionType();
            if (questionType == QuestionType.QUESTION6.getCode()) {
                defaultGroupSequence.add(QuestionAddDto.GroupQuestion.class);
            } else {
                defaultGroupSequence.add(QuestionAddDto.NoneGroupQuestion.class);
            }
        }

        return defaultGroupSequence;
    }
}
