using Managing.Infrastructure.Evm.Models;
using Managing.Infrastructure.Evm.Models.Privy;

namespace Managing.Infrastructure.Evm.Abstractions;

public interface IPrivyService
{
    Task<PrivyWallet> CreateWalletAsync(string chainType = "ethereum");

    Task<HttpResponseMessage> SendTransactionAsync(string walletId, string recipientAddress, long value,
        string caip2 = "eip155:84532");

    /// <summary>
    /// Signs a message using the embedded wallet
    /// </summary>
    /// <param name="embeddedWallet">The ID of the wallet to use for signing</param>
    /// <param name="message">The message to sign</param>
    /// <param name="method">The signing method to use (e.g., "personal_sign", "eth_sign")</param>
    /// <returns>The signature response</returns>
    Task<string> SignMessageAsync(string embeddedWallet, string message,
        string method = "personal_sign");

    /// <summary>
    /// Signs typed data (EIP-712) using the embedded wallet
    /// </summary>
    /// <param name="walletId">The ID of the wallet to use for signing</param>
    /// <param name="typedData">The typed data to sign (must be a valid JSON string conforming to EIP-712)</param>
    /// <param name="caip2">The CAIP-2 chain identifier</param>
    /// <returns>The signature</returns>
    Task<string> SignTypedDataAsync(string walletId, string typedData, string caip2 = "eip155:84532");

    /// <summary>
    /// Gets information about a user, including their linked wallet accounts and delegation status
    /// </summary>
    /// <param name="userDid">The Privy DID of the user (format: did:privy:XXXXX)</param>
    /// <returns>User information including wallets and delegation status</returns>
    Task<PrivyUserInfo> GetUserWalletsAsync(string userDid);

    /// <summary>
    /// Generates an authorization signature for a request to the Privy API
    /// </summary>
    /// <param name="url">The full URL for the request</param>
    /// <param name="body">The request body</param>
    /// <param name="httpMethod">The HTTP method to use for the request (defaults to POST)</param>
    /// <returns>The generated signature</returns>
    string GenerateAuthorizationSignature(string url, object body, string httpMethod = "POST");
}