import React from 'react';
import type { ProviderId } from '../lib/providers';
import type { StoredModel } from './ModelContext';
export type CredentialUpdateAction = 'upsert' | 'delete';
export interface ProviderCredentialUpdatePayload {
    action: CredentialUpdateAction;
    providerId: ProviderId;
    modelId: string;
    model: StoredModel | null;
    allModels: StoredModel[];
}
export interface SanitizedCredentialUpdatePayload extends Omit<ProviderCredentialUpdatePayload, 'model' | 'allModels'> {
    model: StoredModel | null;
    allModels: StoredModel[];
}
interface CredentialStatusRecord {
    status: 'idle' | 'pending' | 'success' | 'error';
    error?: unknown;
    updatedAt: number;
}
interface CredentialContextValue {
    submitCredentials: (payload: ProviderCredentialUpdatePayload) => Promise<void>;
    getStatus: (providerId: ProviderId) => CredentialStatusRecord;
    resetStatus: (providerId: ProviderId) => void;
    isLoadingInitialCredentials: boolean;
    credentialError: unknown;
}
declare const CredentialContext: React.Context<CredentialContextValue>;
interface CredentialSyncProviderProps {
    children: React.ReactNode;
    onSubmit?: (payload: SanitizedCredentialUpdatePayload) => Promise<void> | void;
    onRefresh?: () => Promise<void>;
    initialLoading?: boolean;
    initialError?: unknown;
}
export declare const CredentialSyncProvider: React.FC<CredentialSyncProviderProps>;
export declare const useCredentialSync: (providerId?: ProviderId) => {
    submitCredentials: (payload: ProviderCredentialUpdatePayload) => Promise<void>;
    resetStatus: (providerId: ProviderId) => void;
    status: CredentialStatusRecord;
    isLoadingInitialCredentials: boolean;
    credentialError: unknown;
};
export default CredentialContext;
//# sourceMappingURL=CredentialContext.d.ts.map