import { createHandlerChainRunner, Handler } from "@insite/client-framework/HandlerCreator";
import { sendAutocompleteEvent } from "@insite/client-framework/OdpEvents/AutocompleteEvent";

type Parameter = {
    searchQuery?: string;
    searchPosition?: number;
    attributionToken?: string;
};

type HandlerType = Handler<Parameter>;

export const SendOdpEvent: HandlerType = props => {
    sendAutocompleteEvent(props.parameter, props.getState);
};

export const chain = [SendOdpEvent];

const sendAutocompleteOdpEvent = createHandlerChainRunner(chain, "SendAutocompleteOdpEvent");
export default sendAutocompleteOdpEvent;
