package com.simuwang.base.config;

import cn.hutool.core.collection.ListUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.LinkedHashMap;
import java.util.List;

@Setter
@Getter
@Configuration
@ConfigurationProperties(prefix = DaqProperties.DAQ_CONFIG_PREFIX)
public class DaqProperties {
    public static final String DAQ_CONFIG_PREFIX = "simuwang";
    /**
     * 是否启用操作日志记录功能
     */
    private Boolean enableLogging = Boolean.TRUE;
    /**
     * 默认的密码
     */
    private String defaultPwd;
    /**
     * token 过期时间，单位分钟
     */
    private Long tokenExpire = 60 * 24L;
    /**
     * token 的秘钥（长度为64）
     */
    private String tokenSecret;
    /**
     * 是否开启python的报告解析功能，开启后报告全部用python接口来解析
     * 当开启时要配置python解析地址
     */
    private Boolean enablePyParser = Boolean.FALSE;
    /**
     * 报告解析的python接口地址
     */
    private String pyBaseUrl = "http://localhost:8080";
    /**
     * 基于rsa的加解密方式
     */
    private SecurityRsa securityRsa;
    /**
     * shiro 过滤器配置
     */
    private List<FilterChain> shiroFilterChain = ListUtil.list(true);

    @Setter
    @Getter
    public static class SecurityRsa {
        private String publicKey;
        private String privateKey;
    }

    @Setter
    @Getter
    public static class FilterChain {
        private String path;
        private List<String> filters;
    }
}
