using Managing.Application.Abstractions;
using Managing.Application.Abstractions.Services;
using Managing.Domain.Accounts;
using Managing.Domain.MoneyManagements;
using Managing.Domain.Users;
using Managing.Infrastructure.Tests;
using Moq;
using static Managing.Common.Enums;

namespace Managing.Application.Tests;

public class BaseTests
{
    public readonly Mock<IMoneyManagementService> _moneyManagementService;
    public readonly Mock<IAccountService> _accountService;
    public readonly IExchangeService _exchangeService;
    public readonly Mock<ITradingService> _tradingService;
    public readonly MoneyManagement MoneyManagement;
    public readonly Account _account;

    public BaseTests()
    {
        _account = PrivateKeys.GetAccount();
        _accountService = new Mock<IAccountService>();
        _moneyManagementService = new Mock<IMoneyManagementService>();
        MoneyManagement = new MoneyManagement()
        {
            Leverage = 2, // x2
            Timeframe = Timeframe.FifteenMinutes,
            StopLoss = 0.008m, // 0.8%
            TakeProfit = 0.02m, // 2% 
            Name = "Default MM"
        };

        _ = _moneyManagementService.Setup(m => m.GetMoneyMangement(It.IsAny<User>(), It.IsAny<string>()))
            .Returns(Task.FromResult(MoneyManagement));

        _accountService.Setup(a => a.GetAccount(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<bool>()))
            .Returns(Task.FromResult(_account));

        _tradingService = new Mock<ITradingService>();
        _exchangeService = TradingBaseTests.GetExchangeService();
    }
}