import { createEvent, OdpEvent, sendEvent } from "@insite/client-framework/OdpEvents/OdpEvent";
import ApplicationState from "@insite/client-framework/Store/ApplicationState";
import { getCurrentCartState } from "@insite/client-framework/Store/Data/Carts/CartsSelector";
import { getCurrentPage } from "@insite/client-framework/Store/Data/Pages/PageSelectors";
import PageProps from "@insite/client-framework/Types/PageProps";

export const sendAddToWishListEvent = (
    parameter: {
        productId: string;
        wishListId: string;
    },
    state: ApplicationState,
    customize?: (odpEvent: OdpEvent) => void,
) => {
    const odpEvent = createEvent("product", state);
    odpEvent.properties["action"] = "add_to_wishlist";
    odpEvent.properties["product_id"] = parameter.productId;
    odpEvent.properties["wishlist_identifier"] = parameter.wishListId;

    customize?.(odpEvent);

    sendEvent(odpEvent, state);
};

export const sendRemoveFromWishListEvent = (
    parameter: {
        productId: string;
        wishListId: string;
    },
    state: ApplicationState,
    customize?: (odpEvent: OdpEvent) => void,
) => {
    const odpEvent = createEvent("product", state);
    odpEvent.properties["action"] = "remove_from_wishlist";
    odpEvent.properties["product_id"] = parameter.productId;
    odpEvent.properties["wishlist_identifier"] = parameter.wishListId;

    customize?.(odpEvent);

    sendEvent(odpEvent, state);
};
