package com.staffing.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 * 
 * @author staffing
 */
@Component
@ConfigurationProperties(prefix = "staffing")
public class StaffingConfig
{
    /** 项目名称 */
    private String name;

    /** 版本 */
    private String version;

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

    /** 上传路径 */
    private static String profile;

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

    /** 验证码类型 */
    private static String captchaType;


    /** 二维码 地址内容 */
    private String genPicCodeUrl;

    /** minio 文件前缀 */
    private static String picPrefix;

    /** 小程序 */
    private static boolean appId;

    /** 小程序 */
    private static String secret;


    public String getGenPicCodeUrl() {
        return genPicCodeUrl;
    }

    public void setGenPicCodeUrl(String genPicCodeUrl) {
        this.genPicCodeUrl = genPicCodeUrl;
    }

    public static String getPicPrefix() {
        return picPrefix;
    }

    public static void setPicPrefix(String picPrefix) {
        StaffingConfig.picPrefix = picPrefix;
    }

    public static boolean isAppId() {
        return appId;
    }

    public static void setAppId(boolean appId) {
        StaffingConfig.appId = appId;
    }

    public static String getSecret() {
        return secret;
    }

    public static void setSecret(String secret) {
        StaffingConfig.secret = secret;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getVersion()
    {
        return version;
    }

    public void setVersion(String version)
    {
        this.version = version;
    }

    public String getCopyrightYear()
    {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear)
    {
        this.copyrightYear = copyrightYear;
    }

    public static String getProfile()
    {
        return profile;
    }

    public void setProfile(String profile)
    {
        StaffingConfig.profile = profile;
    }

    public static boolean isAddressEnabled()
    {
        return addressEnabled;
    }

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

    public static String getCaptchaType() {
        return captchaType;
    }

    public void setCaptchaType(String captchaType) {
        StaffingConfig.captchaType = captchaType;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath()
    {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath()
    {
        return getProfile() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath()
    {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }
}
