import { NumberValue } from '@coveo/bueno';
import { createAction } from '@reduxjs/toolkit';
import { nonRequiredEmptyAllowedString, requiredNonEmptyString, validatePayload, } from '../../../utils/validate-payload.js';
export const slotIdDefinition = {
    slotId: nonRequiredEmptyAllowedString,
};
const setPageSizeDefinition = {
    ...slotIdDefinition,
    pageSize: new NumberValue({ required: true, min: 0 }),
};
export const setPageSize = createAction('commerce/pagination/setPageSize', (payload) => validatePayload(payload, setPageSizeDefinition));
const selectPageDefinition = {
    ...slotIdDefinition,
    page: new NumberValue({ required: true, min: 0 }),
};
export const selectPage = createAction('commerce/pagination/selectPage', (payload) => validatePayload(payload, selectPageDefinition));
export const nextPage = createAction('commerce/pagination/nextPage', (payload) => validatePayload(payload, slotIdDefinition));
export const previousPage = createAction('commerce/pagination/previousPage', (payload) => validatePayload(payload, slotIdDefinition));
export const registerRecommendationsSlotPagination = createAction('commerce/pagination/registerRecommendationsSlot', (payload) => validatePayload(payload, {
    slotId: requiredNonEmptyString,
}));
