package ink.wgink.properties;

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

/**
 * @ClassName: BaseConfig
 * @Description: 基础配置
 * @Author: WangGeng
 * @Date: 2019/2/25 5:27 PM
 * @Version: 1.0
 **/
@Component
@ConfigurationProperties(prefix = "spring")
public class BaseProperties {

    private String loginUrl;
    private String loginFailure;
    private String assetsMatchers;
    private String loginProcess;
    private String successForwardUrl;

    public String getLoginUrl() {
        return loginUrl;
    }

    public void setLoginUrl(String loginUrl) {
        this.loginUrl = loginUrl;
    }

    public String getLoginFailure() {
        return loginFailure == null ? "" : loginFailure.trim();
    }

    public void setLoginFailure(String loginFailure) {
        this.loginFailure = loginFailure;
    }

    public String getAssetsMatchers() {
        return assetsMatchers;
    }

    public void setAssetsMatchers(String assetsMatchers) {
        this.assetsMatchers = assetsMatchers;
    }

    public String getLoginProcess() {
        return loginProcess;
    }

    public void setLoginProcess(String loginProcess) {
        this.loginProcess = loginProcess;
    }

    public String getSuccessForwardUrl() {
        return successForwardUrl == null ? null : successForwardUrl.trim();
    }

    public void setSuccessForwardUrl(String successForwardUrl) {
        this.successForwardUrl = successForwardUrl;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"loginUrl\":\"")
                .append(loginUrl).append('\"');
        sb.append(",\"loginFailure\":\"")
                .append(loginFailure).append('\"');
        sb.append(",\"assetsMatchers\":\"")
                .append(assetsMatchers).append('\"');
        sb.append(",\"loginProcess\":\"")
                .append(loginProcess).append('\"');
        sb.append(",\"successForwardUrl\":\"")
                .append(successForwardUrl).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
