package jnpf.model.enums;

import jnpf.model.notice.enums.NoticeEnums;

public class ExamConfigEnums {

    /**
     * 是否开启水印:0-不开启,1-开启
     */
    public enum WatermarkStatus {
        DISABLED(0, "不开启"),
        ENABLED(1, "开启");

        private Integer code;
        private String description;

        WatermarkStatus(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.WatermarkStatus fromCode(Integer code) {
            for (ExamConfigEnums.WatermarkStatus status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }

    /**
     * 是否开启切屏限制:0-不开启,1-开启
     */
    public enum ScreenLockStatus {
        DISABLED(0, "不开启"),
        ENABLED(1, "开启");

        private Integer code;
        private String description;

        ScreenLockStatus(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.ScreenLockStatus fromCode(Integer code) {
            for (ExamConfigEnums.ScreenLockStatus status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }

    /**
     * 是否禁止截屏:0-不禁止,1-禁止
     */
    public enum ScreenshotRestriction {
        ALLOWED(0, "不禁止"),
        FORBIDDEN(1, "禁止");

        private Integer code;
        private String description;

        ScreenshotRestriction(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.ScreenshotRestriction fromCode(Integer code) {
            for (ExamConfigEnums.ScreenshotRestriction status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }

    /**
     * 是否禁止复制粘贴:0-不禁止,1-禁止
     */

    public enum CopyPasteRestriction {
        ALLOWED(0, "不禁止"),
        FORBIDDEN(1, "禁止");

        private Integer code;
        private String description;

        CopyPasteRestriction(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.CopyPasteRestriction fromCode(Integer code) {
            for (ExamConfigEnums.CopyPasteRestriction status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }

    /**
     * 是否开启用户超时无交互退出是作弊:0-不开启,1-开启
     */

    public enum UserInactivityTimeoutCheatingPolicy {
        DISABLED(0, "不开启"),
        ENABLED(1, "开启");

        private Integer code;
        private String description;

        UserInactivityTimeoutCheatingPolicy(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.UserInactivityTimeoutCheatingPolicy fromCode(Integer code) {
            for (ExamConfigEnums.UserInactivityTimeoutCheatingPolicy status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }

    /**
     * 考试完成是否允许查看考试详情:0-允许,1-不允许
     */

    public enum ExamDetailVisibility {
        ALLOWED(0, "允许"),
        NOT_ALLOWED(1, "不允许");

        private Integer code;
        private String description;

        ExamDetailVisibility(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.ExamDetailVisibility fromCode(Integer code) {
            for (ExamConfigEnums.ExamDetailVisibility status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }

    /**
     * 是否允许回到上一题:0-允许,1-不允许
     */
    public enum BackToPreviousQuestionPolicy {
        ALLOWED(0, "允许"),
        NOT_ALLOWED(1, "不允许");

        private Integer code;
        private String description;

        BackToPreviousQuestionPolicy(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.BackToPreviousQuestionPolicy fromCode(Integer code) {
            for (ExamConfigEnums.BackToPreviousQuestionPolicy status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }
    /**
     *  用户考试结果是否有效:0-有效,1-超过切屏次数视为作弊,2-超过考试时间无交互视为作弊
     */

    public enum ExamValidity {
        VALID(0, "有效"),
        CHEATING_SCREEN_LIMIT_EXCEEDED(1, "超过切屏次数视为作弊"),
        CHEATING_NO_INTERACTION_TIME_EXCEEDED(2, "超过考试时间无交互视为作弊");

        private Integer code;
        private String description;

        ExamValidity(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        // 提供一个静态方法来根据代码查找枚举值
        public static ExamConfigEnums.ExamValidity fromCode(Integer code) {
            for (ExamConfigEnums.ExamValidity status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
    }
}

