import { ExistingItemHandling } from '@scayle/storefront-api';
import type { AddOrUpdateItemError, UpdateBasketItemQuantity, GetApplicablePromotionsByCodeParameters, BulkUpdatePromotionsParameters } from '@scayle/storefront-api';
import type { AddOrUpdateItemType, BasketResponseData, BasketWithOptions, Product, RpcHandler, Variant } from '../../../types';
import { mergeBaskets as mergeBasketFunction } from '../../../utils/user';
/**
 * Adds an item to the basket.
 *
 * @param params The parameters for adding a single item to a basket.
 * @param params.variantId The ID of the variant to add.
 * @param params.promotionId @deprecated - In a future release `promotionId` will be removed. Consider using {@link params.promotions} instead.
 * @param params.promotions The promotions to add.
 * @param params.quantity The quantity of the item to add.
 * @param params.displayData Display data for the item.
 * @param params.customData Custom data for the item.
 * @param params.existingItemHandling How to handle existing items, default to `'AddQuantityToExisting'`.
 * @param params.itemGroup The item group.
 * @param params.with withParams for basket.
 * @param params.orderCustomData @deprecated - will be removed in the next major version. Use `getOrderCustomData` RPC method instead.
 * @param context The RPC context.
 *
 * @returns The updated basket, potentially with errors. It will return
 * an `ErrorResponse` if no session is found or adding to basket fails.
 */
export declare const addItemToBasket: RpcHandler<AddOrUpdateItemType & {
    existingItemHandling?: ExistingItemHandling;
    with?: BasketWithOptions;
    orderCustomData?: Record<string, unknown>;
}, {
    basket: BasketResponseData<Product, Variant>;
    errors?: AddOrUpdateItemError[];
}>;
/**
 * Adds multiple items to the basket.
 *
 * @param params The parameters for adding multiple items to a basket.
 * @param params.items An array of items to add.
 * @param params.existingItemHandling How to handle existing items.
 * @param params.with withParams for basket.
 * @param params.orderCustomData @deprecated - will be removed in the next major version. Use `getOrderCustomData` RPC method instead.
 * @param context The RPC context.
 *
 * @returns The updated basket, potentially with errors. It will return
 * an `ErrorResponse` if no session is found or adding to basket fails.
 */
export declare const addItemsToBasket: RpcHandler<{
    items: AddOrUpdateItemType[];
    existingItemHandling: ExistingItemHandling;
    with?: BasketWithOptions;
    orderCustomData?: Record<string, unknown>;
}, {
    basket: BasketResponseData<Product, Variant>;
    errors?: AddOrUpdateItemError[];
}>;
/**
 * Retrieves the current basket.
 *
 * @param options The options for retrieving the basket.
 * @param options.orderCustomData @deprecated - will be removed in the next major version. Use `getOrderCustomData` RPC method instead.
 * @param context The RPC context.
 *
 * @returns The basket data. It will return an `ErrorResponse` alternatively
 * if no session is found or retrieving the basket fails.
 */
export declare const getBasket: RpcHandler<(BasketWithOptions & {
    orderCustomData?: Record<string, unknown>;
}) | undefined, {
    basket: BasketResponseData<Product, Variant>;
}>;
/**
 * Removes an item from the basket.
 *
 * @param options The options for removing the item.
 * @param options.itemKey The key of the item to remove.
 * @param options.with withParams for basket.
 * @param options.orderCustomData @deprecated - will be removed in the next major version. Use `getOrderCustomData` RPC method instead.
 * @param context The RPC context.
 *
 * @returns The updated basket. It will return an `ErrorResponse` alternatively
 * if no session is found or removing the item fails.
 */
export declare const removeItemFromBasket: RpcHandler<{
    itemKey: string;
    with?: BasketWithOptions;
    orderCustomData?: Record<string, unknown>;
}, {
    basket: BasketResponseData<Product, Variant>;
}>;
/**
 * Clears the basket, by removing all items sequentially.
 *
 * @param context The RPC context.
 *
 * @returns True if the basket was cleared successfully. It will return
 * an `ErrorResponse` alternatively if an error occurs during basket clearing.
 */
export declare const clearBasket: RpcHandler<boolean>;
/**
 * Merges two baskets.
 *
 * @param params The parameters for merging baskets.
 * @param params.fromBasketKey The key of the source basket.
 * @param params.toBasketKey The key of the target basket.
 * @param params.with withParams for basket.
 * @param params.orderCustomData @deprecated - will be removed in the next major version. Use `getOrderCustomData` RPC method instead.
 * @param context The RPC context.
 *
 * @returns The new merged basket as result of the merge operation.
 */
export declare const mergeBaskets: RpcHandler<{
    fromBasketKey: string;
    toBasketKey: string;
    with?: BasketWithOptions;
    orderCustomData?: Record<string, unknown>;
}, Awaited<ReturnType<typeof mergeBasketFunction>>>;
/**
 * Type defining an object containing properties of a basket item than should be
 * applied to the basket item during the update.
 */
export type BasketItemUpdateData = Partial<Omit<UpdateBasketItemQuantity, 'basketKey' | 'itemKey' | 'with' | 'quantity'>> & {
    quantity: number;
};
/**
 *  Interface defining parameters for `UpdateBasketItemRequest`.
 */
export interface UpdateBasketItemRequestParameter {
    /**
     * The key of the item to be updated.
     */
    basketItemKey: string;
    /**
     * The update data that should be applied to the basket item.
     */
    update: BasketItemUpdateData;
    /**
     * An object describing which data the returned basket should contain.
     */
    with?: BasketWithOptions;
    orderCustomData?: Record<string, unknown>;
}
/**
 * Applies the provided update data to a specific item in a basket.
 *
 * @param params The parameters for updating a basket item.
 * @param params.basketItemKey The key of the item to be updated.
 * @param params.update The update data that should be applied to the basket item.
 * @param params.with An object describing which data the returned basket should contain.
 * @param params.orderCustomData Custom data for the order.
 * @param context The RPC context.
 *
 * @returns A promise that resolves with the updated basket.
 * In case of an error the, the failure kind will be resolved.
 * It will return an `ErrorResponse` if no session is found or update operation fails.
 */
export declare const updateBasketItem: RpcHandler<UpdateBasketItemRequestParameter, {
    basket: BasketResponseData<Product, Variant>;
}>;
/**
 * Gets the applicable promotions for a basket based on a promotion code.
 *
 * @param params The parameters for updating a basket item.
 * @param params.promotionCode The promotion code to apply.
 * @param params.with An object describing which data the returned basket should contain.
 * @param context The RPC context.
 *
 * @returns A promise that resolves with the updated basket, including the `applicablePromotions` property.
 * It will return an `ErrorResponse` if no session is found.
 */
export declare const getApplicablePromotionsByCode: RpcHandler<Omit<GetApplicablePromotionsByCodeParameters, 'basketKey'>, {
    basket: BasketResponseData<Product, Variant>;
}>;
/**
 * Updates the promotions for a basket item.
 *
 * @param params The parameters for updating the promotions for a basket item.
 * @param params.itemId The ID of the item to update.
 * @param params.promotions The promotions to update.
 * @param context The RPC context.
 *
 * @returns A promise that resolves with the updated basket.
 * It will return an `ErrorResponse` if no session is found or update operation fails.
 */
export declare const updatePromotions: RpcHandler<Omit<BulkUpdatePromotionsParameters, 'basketKey'>, {
    basket: BasketResponseData<Product, Variant>;
}>;
