// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/auth/GalaxyFDSCredential.java
// public interface GalaxyFDSCredential {
// 
//   /**
//    * Add HTTP header to request
//    * @param request
//    */
//   void addHeader(HttpRequestBase request) throws GalaxyFDSClientException;
// 
//   /**
//    * Adds parameter to the URL string
//    * @param uri
//    * @return
//    */
//   String addParam(String uri);
// }
// 
// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/util/Args.java
// public class Args {
// 
//   public static void check(final boolean expression, final String message) {
//     if (!expression) {
//       throw new IllegalArgumentException(message);
//     }
//   }
// 
//   public static void check(final boolean expression, final String message,
//       final Object... args) {
//     if (!expression) {
//       throw new IllegalArgumentException(String.format(message, args));
//     }
//   }
// 
//   public static void check(final boolean expression, final String message,
//       final Object arg) {
//     if (!expression) {
//       throw new IllegalArgumentException(String.format(message, arg));
//     }
//   }
// 
//   public static <T> T notNull(final T argument, final String name) {
//     if (argument == null) {
//       throw new IllegalArgumentException(name + " may not be null");
//     }
//     return argument;
//   }
// 
//   public static <T extends CharSequence> T notEmpty(final T argument,
//       final String name) {
//     if (argument == null) {
//       throw new IllegalArgumentException(name + " may not be null");
//     }
//     if (argument.length() == 0) {
//       throw new IllegalArgumentException(name + " may not be empty");
//     }
//     return argument;
//   }
// 
//   public static int positive(final int n, final String name) {
//     if (n <= 0) {
//       throw new IllegalArgumentException(name + " may not be negative or zero");
//     }
//     return n;
//   }
// 
//   public static long positive(final long n, final String name) {
//     if (n <= 0) {
//       throw new IllegalArgumentException(name + " may not be negative or zero");
//     }
//     return n;
//   }
// 
//   public static int notNegative(final int n, final String name) {
//     if (n < 0) {
//       throw new IllegalArgumentException(name + " may not be negative");
//     }
//     return n;
//   }
// 
//   public static long notNegative(final long n, final String name) {
//     if (n < 0) {
//       throw new IllegalArgumentException(name + " may not be negative");
//     }
//     return n;
//   }
// 
// }


import com.xiaomi.infra.galaxy.fds.android.auth.GalaxyFDSCredential;
import com.xiaomi.infra.galaxy.fds.android.util.Args;
package com.xiaomi.infra.galaxy.fds.android;


public class FDSClientConfiguration {

  private static final String URI_HTTP_PREFIX = "http://";
  private static final String URI_HTTPS_PREFIX = "https://";
  private static final String URI_CDN = "cdn";
  private static final String URI_SUFFIX = "fds.api.xiaomi.com";
  private static final String URI_CDN_SUFFIX = "fds.api.mi-img.com";

  /**
   * The default timeout for a connected socket.
   */
  public static final int DEFAULT_SOCKET_TIMEOUT_MS = 50 * 1000;

  /**
   * The default max retry times
   */
  public static final int DEFAULT_MAX_RETRY_TIMES = 3;

  /**
   * The default size of a upload part
   */
  public static final int DEFAULT_UPLOAD_PART_SIZE = 4096;

  /**
   * The amount of time to wait (in milliseconds) for data to be transfered
   * over an established, open connection before the connection is timed out.
   * A value of 0 means infinity, and is not recommended.
   */
  private int socketTimeoutMs = DEFAULT_SOCKET_TIMEOUT_MS;
  /**
   * The default timeout for establishing a connection.
   */
  public static final int DEFAULT_CONNECTION_TIMEOUT_MS = 50 * 1000;
  /**
   * The amount of time to wait (in milliseconds) when initially establishing
   * a connection before giving up and timing out. A value of 0 means
   * infinity, and is not recommended.
   */
  private int connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS;

  /**
   * Optional size hint (in bytes) for the low level TCP send buffer. This is
   * an advanced option for advanced users who want to tune low level TCP
   * parameters to try and squeeze out more performance.
   */
  private int socketSendBufferSizeHint = 0;

  /**
   * Optional size hint (in bytes) for the low level TCP receive buffer. This
   * is an advanced option for advanced users who want to tune low level TCP
   * parameters to try and squeeze out more performance.
   */
  private int socketReceiveBufferSizeHint = 0;

  /**
   * The maximum number of times that a failed request will be retried
   */
  private int maxRetryTimes = DEFAULT_MAX_RETRY_TIMES;

  /**
   * The size of each upload part
   */
  private int uploadPartSize = DEFAULT_UPLOAD_PART_SIZE;

  public static final int DEFAULT_THREAD_POOL_CORE_SIZE = 4;

  private int threadPoolCoreSize = DEFAULT_THREAD_POOL_CORE_SIZE;

  public static final int DEFAULT_THREAD_POOL_MAX_SIZE = 10;

  private int threadPoolMaxSize = DEFAULT_THREAD_POOL_MAX_SIZE;

  public static final int DEFAULT_THREAD_POOL_KEEP_ALIVE_SECS = 30;

  private int threadPoolKeepAliveSecs = DEFAULT_THREAD_POOL_KEEP_ALIVE_SECS;

  public static final int DEFAULT_WORK_QUEUE_CAPACITY = 10240;

  private int workQueueCapacity = DEFAULT_WORK_QUEUE_CAPACITY;

  /**
   * The credential of FDS client
   */
// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/auth/GalaxyFDSCredential.java
// public interface GalaxyFDSCredential {
// 
//   /**
//    * Add HTTP header to request
//    * @param request
//    */
//   void addHeader(HttpRequestBase request) throws GalaxyFDSClientException;
// 
//   /**
//    * Adds parameter to the URL string
//    * @param uri
//    * @return
//    */
//   String addParam(String uri);
// }
// 
// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/util/Args.java
// public class Args {
// 
//   public static void check(final boolean expression, final String message) {
//     if (!expression) {
//       throw new IllegalArgumentException(message);
//     }
//   }
// 
//   public static void check(final boolean expression, final String message,
//       final Object... args) {
//     if (!expression) {
//       throw new IllegalArgumentException(String.format(message, args));
//     }
//   }
// 
//   public static void check(final boolean expression, final String message,
//       final Object arg) {
//     if (!expression) {
//       throw new IllegalArgumentException(String.format(message, arg));
//     }
//   }
// 
//   public static <T> T notNull(final T argument, final String name) {
//     if (argument == null) {
//       throw new IllegalArgumentException(name + " may not be null");
//     }
//     return argument;
//   }
// 
//   public static <T extends CharSequence> T notEmpty(final T argument,
//       final String name) {
//     if (argument == null) {
//       throw new IllegalArgumentException(name + " may not be null");
//     }
//     if (argument.length() == 0) {
//       throw new IllegalArgumentException(name + " may not be empty");
//     }
//     return argument;
//   }
// 
//   public static int positive(final int n, final String name) {
//     if (n <= 0) {
//       throw new IllegalArgumentException(name + " may not be negative or zero");
//     }
//     return n;
//   }
// 
//   public static long positive(final long n, final String name) {
//     if (n <= 0) {
//       throw new IllegalArgumentException(name + " may not be negative or zero");
//     }
//     return n;
//   }
// 
//   public static int notNegative(final int n, final String name) {
//     if (n < 0) {
//       throw new IllegalArgumentException(name + " may not be negative");
//     }
//     return n;
//   }
// 
//   public static long notNegative(final long n, final String name) {
//     if (n < 0) {
//       throw new IllegalArgumentException(name + " may not be negative");
//     }
//     return n;
//   }
// 
// }


// Path: src/main/java/com/xiaomi/infra/galaxy/fds/android/FDSClientConfiguration.java
import com.xiaomi.infra.galaxy.fds.android.auth.GalaxyFDSCredential;
import com.xiaomi.infra.galaxy.fds.android.util.Args;

package com.xiaomi.infra.galaxy.fds.android;


public class FDSClientConfiguration {

  private static final String URI_HTTP_PREFIX = "http://";
  private static final String URI_HTTPS_PREFIX = "https://";
  private static final String URI_CDN = "cdn";
  private static final String URI_SUFFIX = "fds.api.xiaomi.com";
  private static final String URI_CDN_SUFFIX = "fds.api.mi-img.com";

  /**
   * The default timeout for a connected socket.
   */
  public static final int DEFAULT_SOCKET_TIMEOUT_MS = 50 * 1000;

  /**
   * The default max retry times
   */
  public static final int DEFAULT_MAX_RETRY_TIMES = 3;

  /**
   * The default size of a upload part
   */
  public static final int DEFAULT_UPLOAD_PART_SIZE = 4096;

  /**
   * The amount of time to wait (in milliseconds) for data to be transfered
   * over an established, open connection before the connection is timed out.
   * A value of 0 means infinity, and is not recommended.
   */
  private int socketTimeoutMs = DEFAULT_SOCKET_TIMEOUT_MS;
  /**
   * The default timeout for establishing a connection.
   */
  public static final int DEFAULT_CONNECTION_TIMEOUT_MS = 50 * 1000;
  /**
   * The amount of time to wait (in milliseconds) when initially establishing
   * a connection before giving up and timing out. A value of 0 means
   * infinity, and is not recommended.
   */
  private int connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS;

  /**
   * Optional size hint (in bytes) for the low level TCP send buffer. This is
   * an advanced option for advanced users who want to tune low level TCP
   * parameters to try and squeeze out more performance.
   */
  private int socketSendBufferSizeHint = 0;

  /**
   * Optional size hint (in bytes) for the low level TCP receive buffer. This
   * is an advanced option for advanced users who want to tune low level TCP
   * parameters to try and squeeze out more performance.
   */
  private int socketReceiveBufferSizeHint = 0;

  /**
   * The maximum number of times that a failed request will be retried
   */
  private int maxRetryTimes = DEFAULT_MAX_RETRY_TIMES;

  /**
   * The size of each upload part
   */
  private int uploadPartSize = DEFAULT_UPLOAD_PART_SIZE;

  public static final int DEFAULT_THREAD_POOL_CORE_SIZE = 4;

  private int threadPoolCoreSize = DEFAULT_THREAD_POOL_CORE_SIZE;

  public static final int DEFAULT_THREAD_POOL_MAX_SIZE = 10;

  private int threadPoolMaxSize = DEFAULT_THREAD_POOL_MAX_SIZE;

  public static final int DEFAULT_THREAD_POOL_KEEP_ALIVE_SECS = 30;

  private int threadPoolKeepAliveSecs = DEFAULT_THREAD_POOL_KEEP_ALIVE_SECS;

  public static final int DEFAULT_WORK_QUEUE_CAPACITY = 10240;

  private int workQueueCapacity = DEFAULT_WORK_QUEUE_CAPACITY;

  /**
   * The credential of FDS client
   */
  private GalaxyFDSCredential credential;