package com.cm.common.dingding.config.properties;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: DingDingAppProperties
 * @Description: 钉钉小程序配置
 * @Author: WangGeng
 * @Date: 2020/8/31 17:45
 * @Version: 1.0
 **/
@Configuration
@ConfigurationProperties(prefix = "open-platform.dingding.app")
public class DingDingAppProperties {

    private Long agentId;
    private Boolean active;
    private String appKey;
    private String appSecret;
    private String tokenUrl;
    private String useridByUnionidUrl;
    private String userinfoByIdUrl;

    public Long getAgentId() {
        return agentId;
    }

    public void setAgentId(Long agentId) {
        this.agentId = agentId;
    }

    public Boolean getActive() {
        return active;
    }

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

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

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

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

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

    public String getTokenUrl() {
        return tokenUrl == null ? "" : tokenUrl.trim();
    }

    public void setTokenUrl(String tokenUrl) {
        this.tokenUrl = tokenUrl;
    }

    public String getUseridByUnionidUrl() {
        return useridByUnionidUrl == null ? "" : useridByUnionidUrl.trim();
    }

    public void setUseridByUnionidUrl(String useridByUnionidUrl) {
        this.useridByUnionidUrl = useridByUnionidUrl;
    }

    public String getUserinfoByIdUrl() {
        return userinfoByIdUrl == null ? "" : userinfoByIdUrl.trim();
    }

    public void setUserinfoByIdUrl(String userinfoByIdUrl) {
        this.userinfoByIdUrl = userinfoByIdUrl;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"agentId\":")
                .append(agentId);
        sb.append(",\"active\":")
                .append(active);
        sb.append(",\"appKey\":\"")
                .append(appKey).append('\"');
        sb.append(",\"appSecret\":\"")
                .append(appSecret).append('\"');
        sb.append(",\"tokenUrl\":\"")
                .append(tokenUrl).append('\"');
        sb.append(",\"useridByUnionidUrl\":\"")
                .append(useridByUnionidUrl).append('\"');
        sb.append(",\"userinfoByIdUrl\":\"")
                .append(userinfoByIdUrl).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
