using CryptoExchange.Net.Authentication;
using System;

namespace CryptoExchange.Net.Objects.Options
{
    /// <summary>
    /// Exchange options
    /// </summary>
    public class ExchangeOptions
    {
        /// <summary>
        /// Whether or not to automatically sync the local time with the server time
        /// </summary>
        public bool AutoTimestamp { get; set; }
        /// <summary>
        /// Proxy settings
        /// </summary>
        public ApiProxy? Proxy { get; set; }

        /// <summary>
        /// If true, the CallResult and DataEvent objects will also include the originally received string data in the OriginalData property.
        /// Note that this comes at a performance cost
        /// </summary>
        public bool OutputOriginalData { get; set; } = false;
        /// <summary>
        /// A group name to use for client side rate limiting. Requests with the same group name will be counted together for rate limiting purposes. If null all requests will be counted together.
        /// </summary>
        public string? RateLimitGroup { get; set; }

        /// <summary>
        /// The max time a request is allowed to take
        /// </summary>
        public TimeSpan RequestTimeout { get; set; } = TimeSpan.FromSeconds(20);

        /// <summary>
        /// Whether or not client side rate limiting should be applied
        /// </summary>
        public bool RateLimiterEnabled { get; set; } = true;
        /// <summary>
        /// What should happen when a rate limit is reached
        /// </summary>
        public RateLimitingBehaviour RateLimitingBehaviour { get; set; } = RateLimitingBehaviour.Wait;

        /// <inheritdoc />
        public override string ToString()
        {
            return $"RequestTimeout: {RequestTimeout}, Proxy: {(Proxy == null ? "-" : "set")}";
        }
    }
}
