package cn.qinys.platform.upms.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * Description:
 *
 * @author tanlie
 * Date: 2024/2/4 17:37
 */
public class UpmsConstants {


    @Getter
    @AllArgsConstructor
    public enum RedisKey {
        //登录相关

        UPMS_AUTH_MENUS("upms:auth_menus:", "已授权菜单", 3600 * 2),
        UPMS_USER_INFO("upms:user_info:", "后台管理登录用户信息", 3600 * 2);
        private final String code;
        private final String msg;
        private final Integer expireTime;
    }


    @Getter
    @AllArgsConstructor
    public enum CaptchaTypeCons {
        // 常量
        WORD_CAPTCHA("1", "字符类型验证码"),
        ARITHMETIC_CAPTCHA("2", "算术类型验证码"),
        ;
        private final String code;
        private final String desc;
    }

    @Getter
    @AllArgsConstructor
    public enum CalcTypeCons {
        // 常量
        PLUS(0, "+"),
        MINUS(1, "-"),
        MULTI(2, "*"),
        DIV(3, "/"),
        ;

        private final Integer code;
        private final String desc;

        public static CalcTypeCons codeOf(Integer code) {
            return Stream.of(values()).filter(e -> Objects.equals(e.getCode(), code)).findAny().orElse(PLUS);
        }
    }

}
