import { _ as defaultBaseState, f as createBaseState, t as PHDocumentController } from "./dist-DZj99xX4.js";
import { T as useDocumentById, c as useDocumentsInSelectedFolder, g as useSelectedDocument, s as useDocumentsInSelectedDrive } from "./dist-DAY54QOk.js";
import { a as utils, d as isObservationDocument, l as assertIsObservationDocument, t as Observation } from "./module-DTep1zWB.js";
//#region document-models/observation/v1/gen/controller.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
const ObservationController = PHDocumentController.forDocumentModel(Observation);
//#endregion
//#region document-models/observation/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		title: null,
		description: null,
		content: null,
		category: null,
		status: "PENDING",
		observedAt: null,
		observedBy: null,
		promotedTo: null,
		promotedAt: 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 ObservationDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createObservationDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/observation/v1/hooks.ts
/** Hook to get a Observation document by its id */
function useObservationDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isObservationDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected Observation document */
function useSelectedObservationDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsObservationDocument(document);
	return [document, dispatch];
}
/** Hook to get all Observation documents in the selected drive */
function useObservationDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isObservationDocument);
}
/** Hook to get all Observation documents in the selected folder */
function useObservationDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isObservationDocument);
}
//#endregion
export { createObservationDocument as a, defaultLocalState as c, useSelectedObservationDocument as i, defaultPHState as l, useObservationDocumentsInSelectedDrive as n, createState as o, useObservationDocumentsInSelectedFolder as r, defaultGlobalState as s, useObservationDocumentById as t, ObservationController as u };

//# sourceMappingURL=observation-CovBSv9M.js.map