using static Managing.Common.Enums;

namespace Managing.Domain.Shared.Helpers
{
    public static class RiskHelpers
    {
        public static decimal GetStopLossPrice(TradeDirection direction, decimal price, LightMoneyManagement moneyManagement)
        {
            return direction == TradeDirection.Long ?
                        price -= price * moneyManagement.StopLoss :
                        price += price * moneyManagement.StopLoss;
        }

        public static decimal GetTakeProfitPrice(TradeDirection direction, decimal price, LightMoneyManagement moneyManagement, int count = 1)
        {
            decimal percentage = moneyManagement.TakeProfit * count;

            price = direction == TradeDirection.Short ? price -= price * percentage : price += price * percentage;
            return price;
        }

        public static RiskLevel GetRiskFromConfidence(Confidence confidence)
        {
            switch (confidence)
            {
                case Confidence.Low:
                    return RiskLevel.Low;
                case Confidence.Medium:
                    return RiskLevel.Medium;
                case Confidence.High:
                    return RiskLevel.High;
                case Confidence.None:
                    break;
            }

            return RiskLevel.Low;
        }
    }
}
