namespace PowderCoating.Application.Interfaces;

public interface IStripeConnectService
{
    /// <summary>Returns the Stripe OAuth URL to begin the Standard Connect onboarding flow.</summary>
    string GetOAuthUrl(int companyId, string redirectUri);

    /// <summary>Exchanges the OAuth authorization code for a StripeAccountId and saves it to the company.</summary>
    Task<(bool Success, string? ErrorMessage)> HandleOAuthCallbackAsync(string code, int companyId);

    /// <summary>Deauthorizes the connected account and clears the company's Stripe Connect fields.</summary>
    Task<(bool Success, string? ErrorMessage)> DisconnectAsync(int companyId);

    /// <summary>
    /// Creates a Stripe PaymentIntent on the connected account for the given amount (in dollars).
    /// Returns the client secret needed by Stripe.js on the payment page.
    /// </summary>
    Task<(bool Success, string? ClientSecret, string? PaymentIntentId, string? ErrorMessage)> CreatePaymentIntentAsync(
        string connectedAccountId,
        decimal invoiceTotal,
        decimal surchargeAmount,
        string currency,
        string invoiceNumber,
        int invoiceId);

    /// <summary>
    /// Creates a Stripe PaymentIntent on the connected account for a quote deposit.
    /// Metadata includes type=deposit so the webhook can distinguish it from invoice payments.
    /// </summary>
    Task<(bool Success, string? ClientSecret, string? PaymentIntentId, string? ErrorMessage)> CreateDepositPaymentIntentAsync(
        string connectedAccountId,
        decimal depositAmount,
        decimal surchargeAmount,
        string currency,
        string quoteNumber,
        int quoteId);
}
