package net.northking.cctp.common.s3;

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

@Configuration
@ConfigurationProperties(prefix = "nk.s3")
public class AmazonS3Properties
{
  private boolean tls = false;
  private String host;
  private int port;
  private String fileServiceMode;
  private String accessKey;
  private String secretKey;
  private String bucket;
  private boolean diskQuota = false;

  private boolean useMsgQueue = false;

  /**
   * 临时文件目录
   */
  private String path;

  public boolean isTls()
  {
    return tls;
  }

  public void setTls(boolean tls)
  {
    this.tls = tls;
  }

  public String getHost()
  {
    return host;
  }

  public void setHost(String host)
  {
    this.host = host;
  }

  public int getPort()
  {
    return port;
  }

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

  public String getAccessKey()
  {
    return accessKey;
  }

  public void setAccessKey(String accessKey)
  {
    this.accessKey = accessKey;
  }

  public String getSecretKey()
  {
    return secretKey;
  }

  public void setSecretKey(String secretKey)
  {
    this.secretKey = secretKey;
  }

  public String getBucket()
  {
    return bucket;
  }

  public void setBucket(String bucket)
  {
    this.bucket = bucket;
  }

  public String getPath()
  {
    return null == path ? "" : path;
  }

  public void setPath(String path)
  {
    this.path = path.replace('\\', '/');
    if (!this.path.endsWith("/"))
    {
      this.path = this.path + "/";
    }
  }

  public boolean isDiskQuota()
  {
    return diskQuota;
  }

  public void setDiskQuota(boolean diskQuota)
  {
    this.diskQuota = diskQuota;
  }

  public boolean isUseMsgQueue()
  {
    return useMsgQueue;
  }

  public void setUseMsgQueue(boolean useMsgQueue)
  {
    this.useMsgQueue = useMsgQueue;
  }

  public String getFileServiceMode() {
    return fileServiceMode;
  }

  public void setFileServiceMode(String fileServiceMode) {
    this.fileServiceMode = fileServiceMode;
  }
}
