/**
 * Quota Fetcher for Antigravity Accounts
 *
 * Fetches quota information from Google Cloud Code internal API.
 * Used for displaying remaining quota percentages and reset times.
 */
import { CLIProxyProvider } from '../types';
import { type AccountInfo, type AccountTier } from '../accounts/account-manager';
import type { ProviderEntitlementEvidence } from '../auth/provider-entitlement-types';
/** Individual model quota info */
export interface ModelQuota {
    /** Model name, e.g., "gemini-3-pro-high" */
    name: string;
    /** Display name from API, e.g., "Gemini 3 Pro" */
    displayName?: string;
    /** Remaining quota as percentage (0-100) */
    percentage: number;
    /** ISO timestamp when quota resets, null if unknown */
    resetTime: string | null;
}
/** Quota fetch result */
export interface QuotaResult {
    /** Whether fetch succeeded */
    success: boolean;
    /** Quota for each available model */
    models: ModelQuota[];
    /** Timestamp of fetch */
    lastUpdated: number;
    /** Upstream HTTP status when available */
    httpStatus?: number;
    /** Stable machine-readable error code */
    errorCode?: string;
    /** Additional provider-specific detail/code from upstream */
    errorDetail?: string;
    /** True if account lacks quota access (403) */
    isForbidden?: boolean;
    /** Error message if fetch failed */
    error?: string;
    /** Provider-specific remediation guidance */
    actionHint?: string;
    /** True when the failure is temporary and retrying later may help */
    retryable?: boolean;
    /** True if token is expired and needs re-auth */
    isExpired?: boolean;
    /** True if token refresh cannot proceed and the account should be re-authenticated */
    needsReauth?: boolean;
    /** ISO timestamp when token expires/expired */
    expiresAt?: string;
    /** True if account hasn't been activated in official Antigravity app */
    isUnprovisioned?: boolean;
    /** Account ID (email) this quota belongs to */
    accountId?: string;
    /** GCP project ID for this account */
    projectId?: string;
    /** Detected account tier based on model access */
    tier?: AccountTier;
    /** Richer provider entitlement evidence derived from live/runtime signals */
    entitlement?: ProviderEntitlementEvidence;
}
declare function buildAntigravityFailure(status: number | undefined, bodyText?: string): Pick<QuotaResult, 'error' | 'errorCode' | 'errorDetail' | 'actionHint' | 'retryable' | 'httpStatus' | 'needsReauth' | 'entitlement'> & {
    isForbidden?: boolean;
};
/**
 * Fetch quota for an Antigravity account
 *
 * @param provider - Provider name (only 'agy' supported)
 * @param accountId - Account identifier (email)
 * @param verbose - Show detailed diagnostics
 * @returns Quota result with models and percentages
 */
export declare function fetchAccountQuota(provider: CLIProxyProvider, accountId: string, verbose?: boolean): Promise<QuotaResult>;
/**
 * Read project ID directly from auth file without making API call
 * Used for quick project ID comparison in doctor command
 */
export declare function readProjectIdFromAuthFile(provider: CLIProxyProvider, accountId: string): string | null;
/** Result for all accounts of a provider */
export interface AllAccountsQuotaResult {
    /** Provider name */
    provider: CLIProxyProvider;
    /** Results per account */
    accounts: Array<{
        account: AccountInfo;
        quota: QuotaResult;
    }>;
    /** Accounts grouped by project ID (for detecting shared projects) */
    projectGroups: Record<string, string[]>;
    /** Timestamp of fetch */
    lastUpdated: number;
}
/**
 * Fetch quota for all accounts of a provider
 * Also detects accounts sharing same GCP project (failover won't help)
 *
 * @param provider - Provider name (only 'agy' supported for quota)
 * @param verbose - Show detailed diagnostics
 * @returns Results for all accounts with project grouping
 */
export declare function fetchAllProviderQuotas(provider: CLIProxyProvider, verbose?: boolean): Promise<AllAccountsQuotaResult>;
export declare const __testExports: {
    buildAntigravityFailure: typeof buildAntigravityFailure;
};
/**
 * Find available account with remaining quota
 * Used by preflight check for auto-switching
 *
 * @param provider - Provider name
 * @param excludeAccountId - Account to exclude (current exhausted account)
 * @param verbose - Show detailed diagnostics
 * @returns Account with available quota, or null if none available
 */
export declare function findAvailableAccount(provider: CLIProxyProvider, excludeAccountId?: string, verbose?: boolean): Promise<{
    account: AccountInfo;
    quota: QuotaResult;
} | null>;
export {};
//# sourceMappingURL=quota-fetcher.d.ts.map