import { RecordValue, StringValue } from '@coveo/bueno';
import { ItemMetaData } from '@coveo/relay-event-types';
import { AsyncThunk } from '@reduxjs/toolkit';
import type { CoveoSearchPageClient, SearchPageClientProvider, CaseAssistClient, CoveoInsightClient, EventBuilder, EventDescription, AnalyticsClientSendEventHook } from 'coveo.analytics';
import { SearchEventResponse } from 'coveo.analytics/dist/definitions/events.js';
import { PartialDocumentInformation, DocumentIdentifier } from 'coveo.analytics/dist/definitions/searchPage/searchPageEvents.js';
import { Logger } from 'pino';
import { CaseAssistAnalyticsProvider, StateNeededByCaseAssistAnalytics } from '../../api/analytics/case-assist-analytics.js';
import { InsightAnalyticsProvider, StateNeededByInsightAnalyticsProvider } from '../../api/analytics/insight-analytics.js';
import { StateNeededByInstantResultsAnalyticsProvider } from '../../api/analytics/instant-result-analytics.js';
import { StateNeededBySearchAnalyticsProvider } from '../../api/analytics/search-analytics.js';
import { GeneratedAnswerCitation } from '../../api/generated-answer/generated-answer-event-payload.js';
import { PreprocessRequest } from '../../api/preprocess-request.js';
import { Result } from '../../api/search/search/result.js';
import { ThunkExtraArguments } from '../../app/thunk-extra-arguments.js';
import { RecommendationAppState } from '../../state/recommendation-app-state.js';
import { SearchAppState } from '../../state/search-app-state.js';
import { ConfigurationSection } from '../../state/state-sections.js';
export interface PreparableAnalyticsActionOptions<StateNeeded extends ConfigurationSection> {
    analyticsClientMiddleware: AnalyticsClientSendEventHook;
    preprocessRequest: PreprocessRequest | undefined;
    logger: Logger;
    getState(): StateNeeded;
}
export type AnalyticsAsyncThunk<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> = AsyncThunk<void, void, AsyncThunkAnalyticsOptions<StateNeeded>>;
export declare function makeBasicNewSearchAnalyticsAction(actionCause: string, getState: () => StateNeededBySearchAnalyticsProvider): {
    actionCause: string;
    type: string;
};
export interface PreparedAnalyticsAction<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> {
    description?: EventDescription;
    action: AnalyticsAsyncThunk<StateNeeded>;
}
type PrepareAnalyticsFunction<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> = (options: PreparableAnalyticsActionOptions<StateNeeded>) => Promise<PreparedAnalyticsAction<StateNeeded>>;
export interface PreparableAnalyticsAction<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> extends AnalyticsAsyncThunk<StateNeeded> {
    prepare: PrepareAnalyticsFunction<StateNeeded>;
}
export type LegacySearchAction = PreparableAnalyticsAction<StateNeededBySearchAnalyticsProvider>;
export type CustomAction = PreparableAnalyticsAction<StateNeededBySearchAnalyticsProvider>;
export type ClickAction = PreparableAnalyticsAction<StateNeededBySearchAnalyticsProvider>;
export type InstantResultsSearchAction = PreparableAnalyticsAction<StateNeededByInstantResultsAnalyticsProvider>;
export type InstantResultsClickAction = PreparableAnalyticsAction<StateNeededByInstantResultsAnalyticsProvider>;
export type InsightAction = PreparableAnalyticsAction<StateNeededByInsightAnalyticsProvider>;
export type CaseAssistAction = PreparableAnalyticsAction<StateNeededByCaseAssistAnalytics>;
export interface AsyncThunkAnalyticsOptions<T extends StateNeededBySearchAnalyticsProvider> {
    state: T;
    extra: ThunkExtraArguments;
}
export interface AsyncThunkInsightAnalyticsOptions<T extends Partial<StateNeededByInsightAnalyticsProvider>> {
    state: T;
    extra: ThunkExtraArguments;
}
export type AnalyticsActionOptions<LegacyStateNeeded extends StateNeededBySearchAnalyticsProvider, StateNeeded extends StateNeededBySearchAnalyticsProvider, LegacyGetBuilderType, LegacyProvider, Client, PayloadType> = Omit<LegacyAnalyticsOptions<LegacyStateNeeded, Client, LegacyProvider>, '__legacy__getBuilder'> & Partial<NextAnalyticsOptions<StateNeeded, PayloadType>> & {
    __legacy__getBuilder: LegacyGetBuilderType;
};
export interface NextAnalyticsOptions<StateNeeded extends InternalLegacyStateNeeded, PayloadType> {
    analyticsType: string;
    analyticsPayloadBuilder: (state: StateNeeded) => PayloadType;
}
export interface LegacyAnalyticsOptions<StateNeeded extends InternalLegacyStateNeeded, Client, Provider> {
    prefix: string;
    __legacy__getBuilder: (client: Client, state: StateNeeded) => Promise<EventBuilder | null> | null;
    __legacy__provider?: (getState: () => StateNeeded) => Provider;
}
type InternalLegacyStateNeeded = StateNeededBySearchAnalyticsProvider | StateNeededByCaseAssistAnalytics;
type LogFunction<Client, StateNeeded> = (client: Client, state: StateNeeded) => Promise<void | SearchEventResponse> | void | null;
export declare const makeAnalyticsAction: {
    <LegacyStateNeeded extends StateNeededBySearchAnalyticsProvider = StateNeededBySearchAnalyticsProvider, ComputedLegacyAnalyticsOptions extends LegacyAnalyticsOptions<LegacyStateNeeded, CoveoSearchPageClient, SearchPageClientProvider> = LegacyAnalyticsOptions<LegacyStateNeeded, CoveoSearchPageClient, SearchPageClientProvider>>(prefix: string, __legacy__getBuilder: (client: CoveoSearchPageClient, state: StateNeededBySearchAnalyticsProvider) => Promise<EventBuilder | null> | null, __legacy__provider?: ComputedLegacyAnalyticsOptions["__legacy__provider"] | undefined): PreparableAnalyticsAction<LegacyStateNeeded>;
    <LegacyStateNeeded extends StateNeededBySearchAnalyticsProvider = StateNeededBySearchAnalyticsProvider, StateNeeded extends StateNeededBySearchAnalyticsProvider = StateNeededBySearchAnalyticsProvider, PayloadType = {}>({ prefix, __legacy__getBuilder, __legacy__provider, analyticsPayloadBuilder, analyticsType, }: AnalyticsActionOptions<LegacyStateNeeded, StateNeeded, (client: CoveoSearchPageClient, state: StateNeededBySearchAnalyticsProvider) => Promise<EventBuilder | null> | null, SearchPageClientProvider, CoveoSearchPageClient, PayloadType>): PreparableAnalyticsAction<StateNeeded>;
};
export declare const makeCaseAssistAnalyticsAction: {
    <LegacyStateNeeded extends StateNeededByCaseAssistAnalytics = StateNeededByCaseAssistAnalytics, ComputedLegacyAnalyticsOptions extends LegacyAnalyticsOptions<LegacyStateNeeded, CaseAssistClient, CaseAssistAnalyticsProvider> = LegacyAnalyticsOptions<LegacyStateNeeded, CaseAssistClient, CaseAssistAnalyticsProvider>>(prefix: string, __legacy__getBuilder: LogFunction<CaseAssistClient, StateNeededByCaseAssistAnalytics>, __legacy__provider?: ComputedLegacyAnalyticsOptions["__legacy__provider"] | undefined): PreparableAnalyticsAction<LegacyStateNeeded>;
    <LegacyStateNeeded extends StateNeededByCaseAssistAnalytics = StateNeededByCaseAssistAnalytics, StateNeeded extends StateNeededByCaseAssistAnalytics = StateNeededByCaseAssistAnalytics, PayloadType = {}>({ prefix, __legacy__getBuilder, __legacy__provider, analyticsPayloadBuilder, analyticsType, }: AnalyticsActionOptions<LegacyStateNeeded, StateNeeded, LogFunction<CaseAssistClient, StateNeededByCaseAssistAnalytics>, CaseAssistAnalyticsProvider, CaseAssistClient, PayloadType>): PreparableAnalyticsAction<StateNeeded>;
};
export declare const makeInsightAnalyticsActionFactory: (actionCause: string) => {
    <LegacyStateNeeded extends StateNeededByInsightAnalyticsProvider = StateNeededByInsightAnalyticsProvider, ComputedLegacyAnalyticsOptions extends LegacyAnalyticsOptions<LegacyStateNeeded, CoveoInsightClient, InsightAnalyticsProvider> = LegacyAnalyticsOptions<LegacyStateNeeded, CoveoInsightClient, InsightAnalyticsProvider>>(prefix: string, __legacy__getBuilder: LogFunction<CoveoInsightClient, StateNeededByInsightAnalyticsProvider>, __legacy__provider?: ComputedLegacyAnalyticsOptions["__legacy__provider"] | undefined): PreparableAnalyticsAction<LegacyStateNeeded>;
    <LegacyStateNeeded extends StateNeededByInsightAnalyticsProvider = StateNeededByInsightAnalyticsProvider, StateNeeded extends StateNeededByInsightAnalyticsProvider = StateNeededByInsightAnalyticsProvider, PayloadType = {}>({ prefix, __legacy__getBuilder, __legacy__provider, analyticsPayloadBuilder, analyticsType, }: AnalyticsActionOptions<LegacyStateNeeded, StateNeeded, LogFunction<CoveoInsightClient, StateNeededByInsightAnalyticsProvider>, InsightAnalyticsProvider, CoveoInsightClient, PayloadType>): PreparableAnalyticsAction<StateNeeded>;
};
export declare const makeNoopAnalyticsAction: () => PreparableAnalyticsAction<StateNeededBySearchAnalyticsProvider>;
export declare const noopSearchAnalyticsAction: () => LegacySearchAction;
export declare const partialDocumentInformation: (result: Result, state: Partial<SearchAppState>) => PartialDocumentInformation;
export declare const partialRecommendationInformation: (result: Result, state: Partial<RecommendationAppState>) => PartialDocumentInformation;
export declare const partialCitationInformation: (citation: GeneratedAnswerCitation, state: Partial<SearchAppState>) => PartialDocumentInformation;
export declare const citationDocumentIdentifier: (citation: GeneratedAnswerCitation) => {
    contentIdKey: string;
    contentIdValue: string;
};
export declare const documentIdentifier: (result: Result) => DocumentIdentifier;
export declare const resultPartialDefinition: {
    uniqueId: StringValue<string>;
    raw: RecordValue;
    title: StringValue<string>;
    uri: StringValue<string>;
    clickUri: StringValue<string>;
    rankingModifier: StringValue<string>;
};
export declare const validateResultPayload: (result: Result) => Partial<{
    uniqueId: string;
    raw: unknown;
    title: string;
    uri: string;
    clickUri: string;
    rankingModifier: string;
}>;
export declare const analyticsEventItemMetadata: (result: Result, state: Partial<SearchAppState>) => ItemMetaData;
export {};
