package gaf3.core.services.code


import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.core.io.ClassPathResource
import org.springframework.core.io.Resource

@ConfigurationProperties(prefix = "gaf.code")
class GafCodeConfigure {

    /**
     * 默认存储类型
     */
    var storeType: StoreType = StoreType.hybrid
    /**
     * 默认资源文件路径
     */
    var codePath: Resource = ClassPathResource("/code/")
    /**
     * 单独指定存储类型
     */
    var storeTypes: Map<String, StoreType> = mutableMapOf()

    fun getStoreType(dict: String): StoreType {
        return storeTypes.get(dict) ?: storeType
    }

    enum class StoreType {
        file, db, hybrid
    }
}