package com.yaoyicloud.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

/**
 * 配置信息
 *
 * @author jimmy
 * @version 1.0.0
 * @date 2024/04/14 13:38
 */
@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "easier.office.pdf")
public class FilerepoProperties {

    private String rootPath = "/serving/server/easier-render";
    /**
     * 基金报告模板
     */
    private String reportTemplateSuffix = "_template.xml";

    /**
     * 文档导出根路径
     * @return
     */
    public String getBasePath() {
        return rootPath + "/temp";
    }

    /**
     * 字体根目录
     * @return
     */
    public String getFontPath() {
        return rootPath + "/file/font";
    }


    /**
     * plus版本审核报告模板路径
     */

    public String getReportImagePath() {
        return getRootPath() + "/file/image/word/media/";
    }

    /**
     * 思源黑体字体路径
     */
    public String getSourceHanSansCnFontPath() {
        return getFontPath() + "/source_han_sans_cn_regular.otf";
    }

    public String getSourceHanSansCnFontMediumPath() {
        return getFontPath() + "/source_han_sans_cn_medium.otf";
    }

    public String getSourceHanSansCnBoldFontPath() {
        return getFontPath() + "/source_han_sans_cn_bold.otf";
    }

    /**
     * plus版本审核报告过期时间(秒)
     */
    private Long plusReportExpireTime = 7L * 24 * 60 * 60;

    /**
     * plus版本审核报告限流
     */
    private Long plusReportRateLimiting = 5L;

    public String getSongFontPath() {
        return getFontPath() + "/SimSun.ttc";
    }

}
