package cn.qinys.platform.base.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

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

/**
 * Description:
 *
 * @author tanlie
 * Date: 2024/3/5 16:31
 */
public class BaseConstants {

    @Getter
    @AllArgsConstructor
    public enum StorageType {
        // 文件存储类型
        LOCAL("local", "本地服务"),
        ZOS("zos", "天翼云 zos");
        private final String code;
        private final String desc;
    }


    @Getter
    @AllArgsConstructor
    public enum NoticeType {
        // 消息类型
        NEW_TASK(1, "新派单任务"),
        TASK_TIMEOUT(2, "任务超时");
        private final Integer code;
        private final String desc;
    }


    @Getter
    @AllArgsConstructor
    public enum StorageSpace {
        // 文件存储空间
        MARKET_MAP("map", "行销图片空间");
        private final String code;
        private final String desc;
    }

    @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);
        }
    }


}
