package com.ztmap.framework.config;

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

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

    /** 版本 */
    private String version;

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

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

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

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

    /** 令牌自定义标识 */
    private String tokenHeader;
    /** 令牌密钥 */
    private String tokenSecret;
    /** 令牌有效期（默认30分钟） */
    private String tokenExpireTime;

    private String hikvisionHost;
    private String hikvisionAppKey;
    private String hikvisionAppSecret;

    public String getHikvisionHost() {
        return hikvisionHost;
    }

    public void setHikvisionHost(String hikvisionHost) {
        this.hikvisionHost = hikvisionHost;
    }

    public String getHikvisionAppKey() {
        return hikvisionAppKey;
    }

    public void setHikvisionAppKey(String hikvisionAppKey) {
        this.hikvisionAppKey = hikvisionAppKey;
    }

    public String getHikvisionAppSecret() {
        return hikvisionAppSecret;
    }

    public void setHikvisionAppSecret(String hikvisionAppSecret) {
        this.hikvisionAppSecret = hikvisionAppSecret;
    }

    public String getTokenHeader() {
        return tokenHeader;
    }

    public void setTokenHeader(String tokenHeader) {
        this.tokenHeader = tokenHeader;
    }

    public String getTokenSecret() {
        return tokenSecret;
    }

    public void setTokenSecret(String tokenSecret) {
        this.tokenSecret = tokenSecret;
    }

    public String getTokenExpireTime() {
        return tokenExpireTime;
    }

    public void setTokenExpireTime(String tokenExpireTime) {
        this.tokenExpireTime = tokenExpireTime;
    }

    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 boolean isDemoEnabled()
    {
        return demoEnabled;
    }

    public void setDemoEnabled(boolean demoEnabled)
    {
        this.demoEnabled = demoEnabled;
    }

    public static String getProfile()
    {
        return profile;
    }

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

    public static boolean isAddressEnabled()
    {
        return addressEnabled;
    }

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

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

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

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