import { isAction } from "@reduxjs/toolkit";
import { SharedActionTypes } from "./shared-api";
const HostActionTypes = {
  ...SharedActionTypes,
  INIT: "INIT",
  CLEAN_UP: "CLEAN_UP",
  CHANGE_DOCUMENT: "CHANGE_DOCUMENT",
  CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP: "CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP",
  SCROLL_DOCUMENT_ELEMENT: "SCROLL_DOCUMENT_ELEMENT",
  MESSAGE_HOST_PROP_CONTROLLER: "MESSAGE_HOST_PROP_CONTROLLER",
  CHANGE_API_RESOURCE: "CHANGE_API_RESOURCE",
  EVICT_API_RESOURCE: "EVICT_API_RESOURCE",
  SET_BUILDER_EDIT_MODE: "SET_BUILDER_EDIT_MODE",
  SET_LOCALIZED_RESOURCE_ID: "SET_LOCALIZED_RESOURCE_ID",
  BUILDER_POINTER_MOVE: "BUILDER_POINTER_MOVE"
};
function init() {
  return { type: HostActionTypes.INIT };
}
function cleanUp() {
  return { type: HostActionTypes.CLEAN_UP };
}
function changeDocument(documentKey, operation) {
  return { type: HostActionTypes.CHANGE_DOCUMENT, payload: { documentKey, operation } };
}
function changeDocumentElementScrollTop(scrollTop) {
  return { type: HostActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP, payload: { scrollTop } };
}
function scrollDocumentElement(scrollTopDelta) {
  return { type: HostActionTypes.SCROLL_DOCUMENT_ELEMENT, payload: { scrollTopDelta } };
}
function messageHostPropController(documentKey, elementKey, propName, message) {
  return {
    type: HostActionTypes.MESSAGE_HOST_PROP_CONTROLLER,
    payload: { documentKey, elementKey, propName, message }
  };
}
function changeApiResource(resource, locale) {
  return { type: HostActionTypes.CHANGE_API_RESOURCE, payload: { resource, locale } };
}
function evictApiResource(id, locale) {
  return { type: HostActionTypes.EVICT_API_RESOURCE, payload: { id, locale } };
}
function setBuilderEditMode(editMode) {
  return {
    type: HostActionTypes.SET_BUILDER_EDIT_MODE,
    payload: { editMode }
  };
}
function setLocalizedResourceId({
  resourceId,
  localizedResourceId,
  locale
}) {
  return {
    type: HostActionTypes.SET_LOCALIZED_RESOURCE_ID,
    payload: { resourceId, localizedResourceId, locale }
  };
}
function builderPointerMove(pointer) {
  return { type: HostActionTypes.BUILDER_POINTER_MOVE, payload: { pointer } };
}
function isHostAction(action) {
  return isAction(action) && Object.hasOwn(HostActionTypes, action.type);
}
export {
  HostActionTypes,
  builderPointerMove,
  changeApiResource,
  changeDocument,
  changeDocumentElementScrollTop,
  cleanUp,
  evictApiResource,
  init,
  isHostAction,
  messageHostPropController,
  scrollDocumentElement,
  setBuilderEditMode,
  setLocalizedResourceId
};
//# sourceMappingURL=host-api.js.map