package com.cf.imes.framework.es.config;

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

import java.time.Duration;

/**
 * es环境配置
 * @author there
 */
@ConfigurationProperties(prefix = "spring.elasticsearch")
public class EsProperties {
    private String uris;

    /**
     * Username for authentication with Elasticsearch.
     */
    private String username;

    /**
     * Password for authentication with Elasticsearch.
     */
    private String password;

    /**
     * Connection timeout used when communicating with Elasticsearch.
     */
    private Duration connectionTimeout = Duration.ofSeconds(5);

    /**
     * Socket timeout used when communicating with Elasticsearch.
     */
    private Duration socketTimeout = Duration.ofSeconds(30);


    private Duration connectionRequestTimeout = Duration.ofSeconds(1);

    /**
     * Prefix added to the path of every request sent to Elasticsearch.
     */
    private String pathPrefix;

    private boolean securityHttpSslEnable = false;

    private String certificatePath;

    public String getUris() {
        return uris;
    }

    public void setUris(String uris) {
        this.uris = uris;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Duration getConnectionTimeout() {
        return this.connectionTimeout;
    }

    public void setConnectionTimeout(Duration connectionTimeout) {
        this.connectionTimeout = connectionTimeout;
    }

    public Duration getSocketTimeout() {
        return this.socketTimeout;
    }

    public void setSocketTimeout(Duration socketTimeout) {
        this.socketTimeout = socketTimeout;
    }

    public String getPathPrefix() {
        return this.pathPrefix;
    }

    public void setPathPrefix(String pathPrefix) {
        this.pathPrefix = pathPrefix;
    }

    public boolean isSecurityHttpSslEnable() {
        return securityHttpSslEnable;
    }

    public void setSecurityHttpSslEnable(boolean securityHttpSslEnable) {
        this.securityHttpSslEnable = securityHttpSslEnable;
    }

    public Duration getConnectionRequestTimeout() {
        return connectionRequestTimeout;
    }

    public void setConnectionRequestTimeout(Duration connectionRequestTimeout) {
        this.connectionRequestTimeout = connectionRequestTimeout;
    }

    public String getCertificatePath() {
        return certificatePath;
    }

    public void setCertificatePath(String certificatePath) {
        this.certificatePath = certificatePath;
    }
}
