package com.ruoyi.web.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.sy.domain.SyMajorCategory;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;
import java.util.Map;

public class TestMarjorDto<T> {

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class CategoryNode {
        String code;
        String name;
        List<CategoryNode> nodes;
    }

    @Data
    public static class TestStats {
        private String matchCode;
        private boolean noMatch;
        private List<TestMatchStat> matchStats;
        private Map<String, Map<String, Integer>> catKeyValueMap;

    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class TestMatchStat {
        String code;
        Integer count;
        boolean matched;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class TestResultDto<T> {
        Long examineeId;
        List<SyMajorCategory> selectedList;
        List<T> datas;
        String matchedCode;
        /** 测试完成 **/
        Boolean testCompleted;
        /** 选译完成 **/
        Boolean selectCompleted;
        /** 无可匹配专业 **/
        Boolean noMatch;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class MentalHealth {
        Long examineeId;
        @JsonFormat(pattern = "yyyy-MM-dd")
        Date endTime;
    }

    @Data
    public static class MentalHealthResult {
        // 测评时间
        @JsonFormat(pattern = "yyyy-MM-dd")
        Date endTime;
        // 学习焦虑
        Integer study;
        // 对人焦虑
        Integer social;
        // 孤独倾向
        Integer alone;
        // 自责倾向
        Integer blamed;
        // 过敏倾向
        Integer sensitive;
        // 身体症状
        Integer body;
        // 恐怖倾向
        Integer fear;
        // 冲动倾向
        Integer implust;

        public void setValue(String name, Integer value) {
            switch(name) {
                case "学习焦虑":
                    study = value;
                    break;
                case "对人焦虑":
                    social = value;
                    break;
                case "孤独倾向":
                    alone = value;
                    break;
                case "自责倾向":
                    blamed = value;
                    break;
                case "过敏倾向":
                    sensitive = value;
                    break;
                case "身体症状":
                    body = value;
                    break;
                case "恐怖倾向":
                    fear = value;
                    break;
                case "冲动倾向":
                    implust = value;
                    break;
                case "效度量表":
                    break;
            }
        }
    }
}
