import { logOpenGeneratedAnswerFollowUpSource, logOpenGeneratedAnswerSource, } from '../../features/generated-answer/generated-answer-analytics-actions.js';
import { generativeQuestionAnsweringIdSelector } from '../../features/generated-answer/generated-answer-selectors.js';
export function buildInteractiveCitationAnalyticsClient(getState) {
    return {
        logCitationOpen(citationId, answerId) {
            const headAnswerId = generativeQuestionAnsweringIdSelector(getState());
            if (answerId !== undefined &&
                headAnswerId !== undefined &&
                answerId !== headAnswerId) {
                return logOpenGeneratedAnswerFollowUpSource(citationId, answerId);
            }
            return answerId !== undefined
                ? logOpenGeneratedAnswerSource(citationId, answerId)
                : logOpenGeneratedAnswerSource(citationId);
        },
    };
}
