using BinanceExchange.API.Enums;
using BinanceExchange.API.Models.Response;
using BinanceExchange.API.Models.WebSocket;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SignalsTest
{
    public class Utils
    {
        public static int GetMinutesForInterval(KlineInterval interval)
 
        {
            switch (interval)
            {
                case KlineInterval.OneMinute:
                    return 1;
                case KlineInterval.ThreeMinutes:
                    return 3;
                case KlineInterval.FiveMinutes:
                    return 5;
                case KlineInterval.FifteenMinutes:
                    return 15;
                case KlineInterval.ThirtyMinutes:
                    return 30;
                case KlineInterval.OneHour:
                    return 60;
                case KlineInterval.TwoHours:
                    return 120;
                case KlineInterval.FourHours:
                    return 240;
                case KlineInterval.EightHours:
                    return 60 * 8;
                case KlineInterval.TwelveHours:
                    return 60 * 12;
                case KlineInterval.SixHours:
                    return 60 * 6;
                case KlineInterval.OneDay:
                    return 60 * 24;
                case KlineInterval.ThreeDays:
                    return 60 * 24 * 3;

                default:
                    return 0;
            }
        }

        public static KlineCandleStickResponse KlineToResponse(BinanceKlineData data)
        {
            KlineCandleStickResponse response = new KlineCandleStickResponse();
            response.Open = data.Kline.Open;
            response.Close = data.Kline.Close;
            response.CloseTime = data.Kline.EndTime;
            response.OpenTime = data.Kline.StartTime;
            response.High = data.Kline.High;
            response.Low = data.Kline.Low;
            response.Volume = data.Kline.Volume;

            return response;
        }
    }
}
