/** biome-ignore-all lint/suspicious/noConfusingVoidType: <> */
import { RecordValue, StringValue } from '@coveo/bueno';
import type { ItemMetaData } from '@coveo/relay-event-types';
import { type AsyncThunk } from '@reduxjs/toolkit';
import type { AnalyticsClientSendEventHook, CaseAssistClient, CoveoInsightClient, CoveoSearchPageClient, EventBuilder, EventDescription, SearchPageClientProvider } from 'coveo.analytics';
import type { SearchEventResponse } from 'coveo.analytics/dist/definitions/events.js';
import type { DocumentIdentifier, PartialDocumentInformation } from 'coveo.analytics/dist/definitions/searchPage/searchPageEvents.js';
import type { Logger } from 'pino';
import { CaseAssistAnalyticsProvider, type StateNeededByCaseAssistAnalytics } from '../../api/analytics/case-assist-analytics.js';
import { InsightAnalyticsProvider, type StateNeededByInsightAnalyticsProvider } from '../../api/analytics/insight-analytics.js';
import type { StateNeededByInstantResultsAnalyticsProvider } from '../../api/analytics/instant-result-analytics.js';
import { type StateNeededBySearchAnalyticsProvider } from '../../api/analytics/search-analytics.js';
import type { GeneratedAnswerCitation } from '../../api/generated-answer/generated-answer-event-payload.js';
import type { PreprocessRequest } from '../../api/preprocess-request.js';
import type { Result } from '../../api/search/search/result.js';
import type { ThunkExtraArguments } from '../../app/thunk-extra-arguments.js';
import type { RecommendationAppState } from '../../state/recommendation-app-state.js';
import type { SearchAppState } from '../../state/search-app-state.js';
import type { ConfigurationSection } from '../../state/state-sections.js';
type 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;
};
type PreparedAnalyticsAction<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> = {
    description?: EventDescription;
    action: AnalyticsAsyncThunk<StateNeeded>;
};
type PrepareAnalyticsFunction<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> = (options: PreparableAnalyticsActionOptions<StateNeeded>) => Promise<PreparedAnalyticsAction<StateNeeded>>;
type PreparableAnalyticsAction<StateNeeded extends ConfigurationSection = StateNeededBySearchAnalyticsProvider> = 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>;
type AsyncThunkAnalyticsOptions<T extends StateNeededBySearchAnalyticsProvider> = {
    state: T;
    extra: ThunkExtraArguments;
};
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;
};
interface NextAnalyticsOptions<StateNeeded extends InternalLegacyStateNeeded, PayloadType> {
    analyticsType: string;
    analyticsPayloadBuilder: (state: StateNeeded) => PayloadType;
}
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 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 {};
