package com.cm.common.wechat.config.pojo;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: WechatMiniProgramProperties
 * @Description: 微信小程序
 * @Author: WangGeng
 * @Date: 2020/5/9 15:50
 * @Version: 1.0
 **/
@Configuration
@ConfigurationProperties(prefix = "open-platform.wechat.mini-app")
public class WechatMiniAppProperties {

    private Boolean active;
    private String authorizeUrl;
    private String bindUserUrl;
    private String grantType;
    private String appKey;
    private String appSecret;

    public Boolean getActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public String getAuthorizeUrl() {
        return authorizeUrl == null ? "" : authorizeUrl;
    }

    public void setAuthorizeUrl(String authorizeUrl) {
        this.authorizeUrl = authorizeUrl;
    }

    public String getBindUserUrl() {
        return bindUserUrl == null ? "" : bindUserUrl;
    }

    public void setBindUserUrl(String bindUserUrl) {
        this.bindUserUrl = bindUserUrl;
    }

    public String getGrantType() {
        return grantType == null ? "" : grantType;
    }

    public void setGrantType(String grantType) {
        this.grantType = grantType;
    }

    public String getAppKey() {
        return appKey == null ? "" : appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getAppSecret() {
        return appSecret == null ? "" : appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"active\":")
                .append(active);
        sb.append(",\"authorizeUrl\":\"")
                .append(authorizeUrl).append('\"');
        sb.append(",\"bindUserUrl\":\"")
                .append(bindUserUrl).append('\"');
        sb.append(",\"grantType\":\"")
                .append(grantType).append('\"');
        sb.append(",\"appKey\":\"")
                .append(appKey).append('\"');
        sb.append(",\"appSecret\":\"")
                .append(appSecret).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
