package com.ruoyi.common.config;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.enums.UserType;
import lombok.Data;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 *
 * @author Lion Li
 */

@Data
@Component
@ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig {
    /**
     * 开发模式
     */
    private Boolean dev=false;
    /**
     * 项目名称
     */
    private String name;

    /**
     * 版本
     */
    private String version;

    /**
     * 版权年份
     */
    private String copyrightYear;

    /**
     * 实例演示开关
     */
    private boolean demoEnabled;

    /**
     * 缓存懒加载
     */
    private boolean cacheLazy;

    /**
     * 获取地址开关
     */
    @Getter
    private static boolean addressEnabled;

    public void setAddressEnabled(boolean addressEnabled) {
        RuoYiConfig.addressEnabled = addressEnabled;
    }

    private DefaultUser defaultUser = new DefaultUser();

    private Tencentcloud tencentcloud = new Tencentcloud();

    @Data
    public static class DefaultUser {
        private Long deptId = 100L;

        private String userType = UserType.APP_USER.getUserType();
        /**
         * 帐号状态（0正常 1停用）
         */
        private String status = UserStatus.OK.getCode();
        /**
         * 角色组
         */
        private Long[] roleIds = {2L};

        /**
         * 岗位组
         */
        private Long[] postIds = {4L};

    }


    public Upload upload = new Upload();

    /**
     * 本地文件存储配置
     */
    @Data
    public static class Upload {

        /**
         * 资源地址前缀
         */
        public String pre = "/upload";

        /**
         * 保存位置
         */
        public String savePath="/upload";
    }

    @Data
    public static class Tencentcloud {
      private String secretId = "AKIDoeWFoKdhaLuFLD1sX2LRItFMI2f7NRRh";
      private String secretKey = "RkspdHuOflngNgnhXRL4Zpq096pLhrmQ";
      private String ocrEndpoint = "ocr.ap-guangzhou.tencentcloudapi.com";
      private String ocrRegion = "ap-guangzhou";
    }
}
