using Managing.Domain.Accounts;
using Managing.Domain.Users;
using static Managing.Common.Enums;

namespace Managing.Application.Abstractions.Services;

public interface IAccountService
{
    Task<Account> CreateAccount(User user, Account account);
    bool DeleteAccount(User user, string name);
    IEnumerable<Account> GetAccountsByUser(User user, bool hideSecrets = true);
    Task<IEnumerable<Account>> GetAccountsByUserAsync(User user, bool hideSecrets = true, bool getBalance = false);
    Task<IEnumerable<Account>> GetAccounts(bool hideSecrets, bool getBalance);
    Task<IEnumerable<Account>> GetAccountsAsync(bool hideSecrets, bool getBalance);
    Task<Account> GetAccount(string name, bool hideSecrets, bool getBalance);
    public Task<Account> GetAccountByUser(User user, string name, bool hideSecrets, bool getBalance);
    public Task<Account> GetAccountByKey(string key, bool hideSecrets, bool getBalance);

    /// <summary>
    /// Gets an account by name directly from the repository.
    /// </summary>
    /// <param name="accountName">The name of the account to find</param>
    /// <param name="hideSecrets">Whether to hide sensitive information</param>
    /// <param name="getBalance">Whether to fetch the current balance</param>
    /// <returns>The found account or null if not found</returns>
    Task<Account> GetAccountByAccountName(string accountName, bool hideSecrets = true, bool getBalance = false);

    IEnumerable<Account> GetAccountsBalancesByUser(User user, bool hideSecrets = true);
    Task<IEnumerable<Account>> GetAccountsBalancesByUserAsync(User user, bool hideSecrets = true);
    Task<GmxClaimableSummary> GetGmxClaimableSummaryAsync(User user, string accountName);

    Task<SwapInfos> SwapGmxTokensAsync(User user, string accountName, Ticker fromTicker, Ticker toTicker,
        double amount, string orderType = "market", double? triggerRatio = null, double allowedSlippage = 0.5);

    Task<SwapInfos> SendTokenAsync(User user, string accountName, string recipientAddress, Ticker ticker,
        decimal amount, int? chainId = null);
}