package com.cool.bang.modules.generate.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * code generate config (代码自动生成配置类)
 *
 * @author PeiZhi Guo
 * @version 1.0.0
 * 2021-3-26 10:19
 */
@Component
@ConfigurationProperties(prefix = "generate")
@PropertySource(value = { "classpath:generate.properties" })
public class GenerateConfig {

    /**
     * 作者
     */
    private static String author;

    /**
     * 包路径
     */
    private static String packageName;

    /**
     * 模块名称
     */
    private static String moduleName;

    /**
     * 自动去除表前缀，默认是true
     */
    private static boolean autoRemovePre;

    /**
     * 表前缀(生成类名不会包含表前缀)
     */
    private static String tablePrefix;

    public static String getAuthor() {
        return author;
    }

    @Value("${generate.author}")
    public void setAuthor(String author) {
        GenerateConfig.author = author;
    }

    public static String getPackageName() {
        return packageName;
    }

    @Value("${generate.packageName}")
    public void setPackageName(String packageName) {
        GenerateConfig.packageName = packageName;
    }

    public static String getModuleName() {
        return moduleName;
    }

    @Value("${generate.moduleName}")
    public void setModuleName(String moduleName) {
        GenerateConfig.moduleName = moduleName;
    }

    public static boolean isAutoRemovePre() {
        return autoRemovePre;
    }

    @Value("${generate.autoRemovePre}")
    public void setAutoRemovePre(boolean autoRemovePre) {
        GenerateConfig.autoRemovePre = autoRemovePre;
    }

    public static String getTablePrefix() {
        return tablePrefix;
    }

    @Value("${generate.tablePrefix}")
    public void setTablePrefix(String tablePrefix) {
        GenerateConfig.tablePrefix = tablePrefix;
    }

}
