package com.qmth.paper.library.common.enums;

import com.qmth.paper.library.common.contant.SystemConstant;
import com.qmth.paper.library.common.entity.BasicField;

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

/**
 * 基础字段枚举
 */
public enum BasicFieldEnum {

    STUDENT_CODE("studentCode", "学号", true, true),
    STUDENT_NAME("studentName", "姓名", true, true),
    COURSE_CODE("courseCode", "课程代码", true, true),
    COURSE_NAME("courseName", "课程名称", true, true),
    COLLEGE_NAME("collegeName", "学院", true, false),
    MAJOR_NAME("majorName", "专业", true, false),
    CLASS_NAME("className", "班级", true, true),
    TEACHER("teacher", "任课老师", true, false),
    TEACH_CLASS("teachClass", "教学班", true, false),
    EXAM_ROOM("examRoom", "考场", true, true),
    SCORE("score", "成绩", true, false),
    REMARK("remark", "备注", true, false);

    private final String code;
    private final String name;

    private final Boolean enable;
    private final Boolean disabled;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public Boolean getEnable() {
        return enable;
    }

    public Boolean getDisabled() {
        return disabled;
    }

    BasicFieldEnum(String code, String name, Boolean enable, Boolean disabled) {
        this.code = code;
        this.name = name;
        this.enable = enable;
        this.disabled = disabled;
    }

    public static List<BasicField> list(Long schoolId){
        List<BasicField> basicFieldList = new ArrayList<>();
        for (BasicFieldEnum value : BasicFieldEnum.values()) {
            BasicField basicField = new BasicField();
            basicField.setId(SystemConstant.getDbUuid());
            basicField.setSchoolId(schoolId);
            basicField.setCode(value.getCode());
            basicField.setName(value.getName());
            basicField.setEnable(value.getEnable());
            basicField.setDisabled(value.getDisabled());
            basicField.setBasicField(true);
            basicFieldList.add(basicField);
        }
        return basicFieldList;
    }
}
