import AnthropicOriginal, { APIPromise } from '@anthropic-ai/sdk';
import { PostHog } from 'posthog-node';
import { Stream } from '@anthropic-ai/sdk/streaming';

interface MonitoringEventPropertiesWithDefaults {
    distinctId?: string;
    traceId: string;
    properties?: Record<string, any>;
    privacyMode: boolean;
    groups?: Record<string, any>;
    modelOverride?: string;
    providerOverride?: string;
    costOverride?: CostOverride;
    captureImmediate?: boolean;
}
type MonitoringEventProperties = Partial<MonitoringEventPropertiesWithDefaults>;
type MonitoringParams = {
    [K in keyof MonitoringEventProperties as `posthog${Capitalize<string & K>}`]: MonitoringEventProperties[K];
};
interface CostOverride {
    inputCost: number;
    outputCost: number;
}

type MessageCreateParamsNonStreaming = AnthropicOriginal.Messages.MessageCreateParamsNonStreaming;
type MessageCreateParamsStreaming = AnthropicOriginal.Messages.MessageCreateParamsStreaming;
type Message = AnthropicOriginal.Messages.Message;
type RawMessageStreamEvent = AnthropicOriginal.Messages.RawMessageStreamEvent;
type MessageCreateParamsBase = AnthropicOriginal.Messages.MessageCreateParams;
type RequestOptions = AnthropicOriginal.RequestOptions;

interface MonitoringAnthropicConfig {
    apiKey: string;
    posthog: PostHog;
    baseURL?: string;
}
declare class PostHogAnthropic extends AnthropicOriginal {
    private readonly phClient;
    messages: WrappedMessages;
    constructor(config: MonitoringAnthropicConfig);
}
declare class WrappedMessages extends AnthropicOriginal.Messages {
    private readonly phClient;
    private readonly baseURL;
    constructor(parentClient: PostHogAnthropic, phClient: PostHog);
    create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
    create(body: MessageCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent>>;
    create(body: MessageCreateParamsBase & MonitoringParams, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent> | Message>;
}

export { PostHogAnthropic as Anthropic, PostHogAnthropic, WrappedMessages, PostHogAnthropic as default };
