namespace GoogleApi.Configuration;
///
/// Root configuration for Google Ads API integration.
/// Bind to the "GoogleAds" section in appsettings.json or environment variables.
///
public sealed class GoogleAdsConfig
{
public const string SectionName = "GoogleAds";
///
/// Enable/disable real API calls. When false, the provider returns emulated responses.
///
public bool EnableRealApi { get; set; } = false;
///
/// Target Google Ads API version used by generated stubs (e.g. "v22").
/// NOTE: This value is informational; the compiled code targets a specific Vxx namespace.
///
public string ApiVersion { get; set; } = "v22";
///
/// Developer token from your Google Ads manager account.
///
public string DeveloperToken { get; set; } = string.Empty;
///
/// OAuth 2.0 application credentials used for server-to-server calls.
///
/// IMPORTANT:
/// - There is no interactive OAuth flow at runtime.
/// - A refresh token is generated once (out-of-band) and stored securely.
/// - This service uses that refresh token to obtain access tokens automatically.
///
public GoogleOAuthConfig OAuth { get; set; } = new();
///
/// Default login customer ID (manager account / MCC) if not specified per request.
/// Format: 1234567890 (no dashes)
///
public string? DefaultLoginCustomerId { get; set; }
///
/// Request timeout in seconds.
///
public int TimeoutSeconds { get; set; } = 60;
}
///
/// OAuth configuration for Google Ads API.
/// This provider uses the "refresh token" (offline) flow for non-interactive server-to-server calls.
///
public sealed class GoogleOAuthConfig
{
public string ClientId { get; set; } = string.Empty;
public string ClientSecret { get; set; } = string.Empty;
///
/// Platform refresh token used to obtain access tokens without user interaction.
/// Store in Key Vault / secret store; inject via environment variables in prod.
///
public string? RefreshToken { get; set; }
}
///
/// Per-request Google Ads context, populated from request and/or database.
///
public sealed class GoogleAdsContext
{
///
/// Target Google Ads customer ID for this request.
/// Format: 1234567890 (no dashes)
///
public required string CustomerId { get; set; }
///
/// Login customer ID (manager account / MCC).
/// Required when accessing client accounts under a manager account.
///
public string? LoginCustomerId { get; set; }
///
/// Optional override refresh token for a specific account (if you ever store per-account tokens).
/// If null, the platform token from config is used.
///
public string? RefreshToken { get; set; }
}