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

import cn.reghao.jutil.jdk.web.validator.ValidEnum;
import cn.reghao.tnb.content.app.exam.model.constant.QuestionLevel;
import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
import cn.reghao.tnb.content.app.exam.model.provider.QuestionAddGroupSequenceProvider;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

/**
 * @author reghao
 * @date 2024-08-25 15:46:19
 */
//@GroupSequenceProvider(QuestionAddGroupSequenceProvider.class)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QuestionAddDto {
    @ValidEnum(value = QuestionType.class, message = "请选择正确的试题类型")
    private Integer questionType;
    private Long questionId;
    @ValidEnum(value = QuestionLevel.class, message = "请选择正确的难度等级")
    private Integer questionLevel;
    @NotNull
    private Integer subjectId;
    @NotBlank
    private String questionContent;
    private String[] images;
    // 试题解析
    private String analysis;
    private String createPerson;
    @Size(min = 1, max = 10, message = "至少要有一个答案", groups = NoneGroupQuestion.class)
    private Option[] options;
    private QuestionAddDto[] children;

    // 答案对象
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Option {
        private Integer id;
        @NotBlank
        private String content;
        private String analysis;
        private String[] images;
        @NotNull
        private Boolean correct;
    }

    public interface GroupQuestion {
    }

    public interface NoneGroupQuestion {
    }
}
