import { p as createBaseState, t as PHDocumentController, v as defaultBaseState } from "./dist-RakiOObV.mjs";
import { T as useDocumentById, c as useDocumentsInSelectedFolder, g as useSelectedDocument, s as useDocumentsInSelectedDrive } from "./dist-DFMBprYi.mjs";
import { a as utils, d as isTensionDocument, l as assertIsTensionDocument, t as Tension } from "./module-tOluXBSt.mjs";
//#region document-models/tension/v1/gen/controller.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
const TensionController = PHDocumentController.forDocumentModel(Tension);
//#endregion
//#region document-models/tension/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		title: null,
		description: null,
		content: null,
		involvedRefs: [],
		status: "OPEN",
		observedAt: null,
		observedBy: null,
		resolution: null,
		resolvedAt: null
	};
}
function defaultLocalState() {
	return {};
}
function defaultPHState() {
	return {
		...defaultBaseState(),
		global: defaultGlobalState(),
		local: defaultLocalState()
	};
}
function createGlobalState(state) {
	return {
		...defaultGlobalState(),
		...state || {}
	};
}
function createLocalState(state) {
	return {
		...defaultLocalState(),
		...state || {}
	};
}
function createState(baseState, globalState, localState) {
	return {
		...createBaseState(baseState?.auth, baseState?.document),
		global: createGlobalState(globalState),
		local: createLocalState(localState)
	};
}
/**
* Creates a TensionDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createTensionDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/tension/v1/hooks.ts
/** Hook to get a Tension document by its id */
function useTensionDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isTensionDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected Tension document */
function useSelectedTensionDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsTensionDocument(document);
	return [document, dispatch];
}
/** Hook to get all Tension documents in the selected drive */
function useTensionDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isTensionDocument);
}
/** Hook to get all Tension documents in the selected folder */
function useTensionDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isTensionDocument);
}
//#endregion
export { createState as a, defaultLocalState as c, useTensionDocumentsInSelectedFolder as i, defaultPHState as l, useTensionDocumentById as n, createTensionDocument as o, useTensionDocumentsInSelectedDrive as r, defaultGlobalState as s, useSelectedTensionDocument as t, TensionController as u };

//# sourceMappingURL=tension-Dx-EaD9W.mjs.map