package com.qmth.boot.mybatis.config;

import com.qmth.boot.core.constant.CoreConstant;
import com.qmth.boot.core.logger.constant.LoggerConstant;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotNull;

@Component
@ConfigurationProperties(prefix = CoreConstant.CONFIG_PREFIX + ".mybatis")
@Validated
public class MybatisProperties {

    private boolean blockAttack = true;

    private boolean schemaValidate = true;

    @NotNull
    private ProfilerProperties profiler = new ProfilerProperties();

    @NotNull
    private String logLevel = LoggerConstant.DEFAULT_LEVEL;

    public boolean isBlockAttack() {
        return blockAttack;
    }

    public void setBlockAttack(boolean blockAttack) {
        this.blockAttack = blockAttack;
    }

    public String getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(String logLevel) {
        this.logLevel = logLevel;
    }

    public boolean isSchemaValidate() {
        return schemaValidate;
    }

    public void setSchemaValidate(boolean schemaValidate) {
        this.schemaValidate = schemaValidate;
    }

    public ProfilerProperties getProfiler() {
        return profiler;
    }

    public void setProfiler(ProfilerProperties profiler) {
        this.profiler = profiler;
    }
}
