/**
 * Settings → AI state.
 *
 * Two persistence surfaces, mirroring the SEO tab's multi-backend pattern:
 *   - Provider connections (create / update / test / disconnect / sync models)
 *     act IMMEDIATELY against `/ai/providers/*`. These touch encrypted secrets,
 *     so they shouldn't sit in a dirty buffer waiting for a Save click.
 *   - Defaults, feature toggles, and the monthly budget are buffered and saved
 *     together via `PUT /ai/settings` through the shared SettingsSaveBar.
 *
 * Provider API keys are never returned by the server; we only ever receive a
 * masked `apiKeyLast4` + a source flag.
 */
export type AiProviderKey = 'openai' | 'anthropic' | 'xai' | 'custom';
export type AiConnectionStatus = 'connected' | 'invalid_key' | 'rate_limited' | 'provider_down' | 'needs_setup' | 'unknown';
export type AiModelStatus = 'available' | 'unavailable' | 'deprecated' | 'unknown';
export interface AiModelView {
    id: string;
    provider: AiProviderKey;
    providerModelId: string;
    displayName: string;
    description?: string;
    status: AiModelStatus;
    capabilities: Record<string, boolean>;
    contextWindow?: number;
    maxOutputTokens?: number;
    inputModalities: string[];
    outputModalities: string[];
    pricing?: {
        inputPerMillion?: number;
        outputPerMillion?: number;
        image?: number;
        search?: number;
    };
    lastSyncedAt: string;
    source: string;
}
export interface AiProviderView {
    id: string;
    provider: AiProviderKey;
    displayName: string;
    enabled: boolean;
    status: AiConnectionStatus;
    apiKeyLast4?: string;
    baseUrl?: string;
    organizationId?: string;
    projectId?: string;
    lastTestedAt?: string;
    lastModelSyncAt?: string;
    apiKeySource: 'environment' | 'database' | 'config';
    keyManagedExternally: boolean;
    hasKey: boolean;
    createdAt: string;
    updatedAt: string;
    updatedBy: string;
}
export interface AiFeatureView {
    key: string;
    label: string;
    description: string;
    enabled: boolean;
    category: string;
    requiredCapabilities: string[];
    /** Per-feature model override (`provider:modelId`). Empty = use the default. */
    modelId?: string;
    /** Per-feature provider connection override. Usually derived from the model. */
    providerId?: string;
}
export interface AiUsageView {
    totalTokens: number;
    promptTokens: number;
    completionTokens: number;
    estimatedCost?: number;
    monthlyTokenLimit?: number;
    periodStart: string;
    periodEnd: string;
    runCount: number;
}
/** Editable brand voice fields (the buffered Save-bar portion). */
export interface BrandVoiceForm {
    enabled: boolean;
    name: string;
    tone: string;
    audience: string;
    guidelines: string;
    sampleText: string;
}
/** The buffered (Save-bar) portion of AI settings. */
export interface AiSettingsForm {
    defaultProviderId: string;
    defaultModelId: string;
    features: AiFeatureView[];
    monthlyTokenLimit: string;
    brandVoice: BrandVoiceForm;
}
type SaveState = 'idle' | 'saving' | 'success' | 'error';
export interface ProviderInput {
    provider: AiProviderKey;
    displayName?: string;
    apiKey?: string;
    baseUrl?: string;
    organizationId?: string;
    projectId?: string;
    enabled?: boolean;
    test?: boolean;
}
export interface UseAiSettings {
    loading: boolean;
    loadError: string | null;
    providers: AiProviderView[];
    models: AiModelView[];
    usage: AiUsageView | null;
    defaultModel: AiModelView | null;
    form: AiSettingsForm;
    setDefaultProvider: (id: string) => void;
    setDefaultModel: (id: string) => void;
    setMonthlyTokenLimit: (value: string) => void;
    toggleFeature: (key: string, enabled: boolean) => void;
    /** Set a per-feature model override. Empty string reverts to the default model. */
    setFeatureModel: (key: string, modelId: string) => void;
    /** Patch one or more brand voice fields. */
    setBrandVoice: (patch: Partial<BrandVoiceForm>) => void;
    dirty: boolean;
    budgetError: string | null;
    saveState: SaveState;
    saveError: string | null;
    save: () => Promise<void>;
    reset: () => void;
    refetch: () => void;
    /** Provider connection actions (persist immediately). */
    createProvider: (input: ProviderInput) => Promise<{
        ok: boolean;
        error?: string;
    }>;
    updateProvider: (id: string, patch: Omit<Partial<ProviderInput>, 'apiKey'> & {
        apiKey?: string | null;
    }) => Promise<{
        ok: boolean;
        error?: string;
    }>;
    deleteProvider: (id: string) => Promise<{
        ok: boolean;
        error?: string;
    }>;
    testProvider: (id: string) => Promise<{
        ok: boolean;
        status?: AiConnectionStatus;
        message?: string;
        error?: string;
    }>;
    syncModels: (id: string) => Promise<{
        ok: boolean;
        fromFallback?: boolean;
        warning?: string | null;
        error?: string;
    }>;
    busyProviderId: string | null;
}
export declare function useAiSettings(canEdit: boolean): UseAiSettings;
export {};
//# sourceMappingURL=useAiSettings.d.ts.map