package ink.wgink.properties.sms;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: SmsConfigProperties
 * @Description: 短信服务属性
 * @Author: WangGeng
 * @Date: 2020/3/9 10:14 下午
 * @Version: 1.0
 **/
@Configuration
@ConfigurationProperties(prefix = "sms")
public class SmsProperties {

    private Boolean active;
    private String type;
    private SmsDefaultProperties defaultSms;
    private SmsTencentProperties tencentSms;

    public Boolean getActive() {
        return active == null ? false : active;
    }

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

    public String getType() {
        return type == null ? "" : type.trim();
    }

    public void setType(String type) {
        this.type = type;
    }

    public SmsDefaultProperties getDefaultSms() {
        return defaultSms;
    }

    public void setDefaultSms(SmsDefaultProperties defaultSms) {
        this.defaultSms = defaultSms;
    }

    public SmsTencentProperties getTencentSms() {
        return tencentSms;
    }

    public void setTencentSms(SmsTencentProperties tencentSms) {
        this.tencentSms = tencentSms;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"active\":")
                .append(active);
        sb.append(",\"type\":\"")
                .append(type).append('\"');
        sb.append(",\"defaultSms\":")
                .append(defaultSms);
        sb.append(",\"tencentSms\":")
                .append(tencentSms);
        sb.append('}');
        return sb.toString();
    }
}
