import { createEvent, OdpEvent, sendEvent } from "@insite/client-framework/OdpEvents/OdpEvent";
import ApplicationState from "@insite/client-framework/Store/ApplicationState";

export const sendProductDetailViewEvent = (
    productId: string,
    state: ApplicationState,
    customize?: (odpEvent: OdpEvent) => void,
) => {
    const odpEvent = createEvent("product", state);
    odpEvent.properties["action"] = "detail";
    odpEvent.properties["product_id"] = productId;

    customize?.(odpEvent);

    sendEvent(odpEvent, state);
};
