using Binance.TradeRobot.Model.Base;
using SDKAdapter.Model;
using System;
using System.Collections.Generic;

namespace SDKAdapter.APIClient
{
    public class BaseAPIClient
    {
        public static BaseAPIClient Create(Enums.Exchange exchange, long accountId, string apiKey, string secret)
        {
            if (exchange == Enums.Exchange.Binance)
                return new BinanceAPIClient(accountId, apiKey, secret);
            return null;
        }

        protected long AccountId { get; private set; }
        protected string ApiKey { get; private set; }
        protected string Secret { get; private set; }

        public BaseAPIClient(long accountId, string apiKey, string secret)
        {
            this.AccountId = accountId;
            this.ApiKey = apiKey;
            this.Secret = secret;
        }

        /// <summary>
        /// 获取逐仓杠杆账户资产
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual IList<IsolatedMarginAccountAsset> GetIsolatedMarginAccountAssets()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 查询最大借币额度(USDT)
        /// </summary>
        /// <param name="symbol"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual decimal QueryMaxLoanAmount(string symbol)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 逐仓杠杆账户借币
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="loanAmount"></param>
        /// <returns>借币结果对象</returns>
        public virtual IsolatedMarginLoanResponse IsolatedMarginLoan(string symbol, decimal loanAmount)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 逐仓杠杆账户还币
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="repayAmount"></param>
        /// <returns>还币利息</returns>
        public virtual decimal IsolatedMarginRepay(string symbol, decimal repayAmount)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 逐仓杠杆下单接口
        /// </summary>
        /// <param name="symbol">交易对</param>
        /// <param name="tradeDirection">交易方向</param>
        /// <param name="orderType">订单类型</param>
        /// <param name="quantity">基础币数量,卖单必传</param>
        /// <param name="quoteAmount">报价币金额,市价买单必传</param>
        /// <param name="price">下单价格,市价不传</param>
        /// <param name="stopPrice">止损价格,与STOP_LOSS,STOP_LOSS_LIMIT一起使用</param>
        /// <param name="newClientOrderId">客户端订单Id</param>
        /// <returns>交易所订单Id</returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual long IsolatedMarginPlaceOrder(string symbol,
                                                     Enums.TradeDirection tradeDirection,
                                                     Enums.OrderType orderType,
                                                     decimal? quantity = null,
                                                     decimal? quoteAmount = null,
                                                     decimal? price = null,
                                                     decimal? stopPrice = null,
                                                     string newClientOrderId = "")
        {
            throw new NotImplementedException();
        }
    }
}