package ink.wgink.properties.websocket;

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

/**
 * @ClassName: WebSocketProperties
 * @Description: WebSocket配置
 * @Author: wanggeng
 * @Date: 2021/9/11 9:51 下午
 * @Version: 1.0
 */
@Component
@ConfigurationProperties(prefix = "websocket")
public class WebSocketProperties {

    private String scheme;
    private String url;
    private Integer port;
    private String context;
    private Boolean isEncrypt;
    private String aesKey;

    public String getScheme() {
        return scheme == null ? "ws" : scheme.trim();
    }

    public void setScheme(String scheme) {
        this.scheme = scheme;
    }

    public String getUrl() {
        return url == null ? "127.0.0.1" : url.trim();
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getPort() {
        return port == null ? 1991 : port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getContext() {
        return context == null ? "websocket" : context.trim();
    }

    public void setContext(String context) {
        this.context = context;
    }

    public Boolean getEncrypt() {
        return isEncrypt == null ? false : isEncrypt;
    }

    public void setEncrypt(Boolean encrypt) {
        isEncrypt = encrypt;
    }

    public String getAesKey() {
        return aesKey == null ? "" : aesKey.trim();
    }

    public void setAesKey(String aesKey) {
        this.aesKey = aesKey;
    }
}
