import { p as createBaseState, t as PHDocumentController, v as defaultBaseState } from "./dist-CYoGQ6PD.mjs";
import { a as utils, d as isGrantApplicationDocument, l as assertIsGrantApplicationDocument, t as GrantApplication } from "./module-Dnc2DHmS.mjs";
import { c as useDocumentsInSelectedDrive, l as useDocumentsInSelectedFolder, p as useSelectedDocument, s as useDocumentById } from "./dist-LFSG_0Q3.mjs";
//#region document-models/grant-application/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		grantPoolsURI: null,
		grantPoolId: null,
		grantPoolName: null,
		projectsURI: null,
		projectId: null,
		projectName: null,
		createdAt: null,
		contentURI: null,
		discussionsTo: null,
		licenseURI: null,
		isInactive: false,
		applicationCompletionRate: null,
		socials: [],
		fundsAsked: [],
		fundsAskedInUSD: null,
		fundsApproved: [],
		fundsApprovedInUSD: null,
		payoutAddress: null,
		status: "pending",
		payouts: [],
		extensions: null,
		paymentTerm: null,
		reviewStage: "DRAFT",
		feedbackNotes: null,
		revisionCount: 0,
		submitter: null,
		submittedAt: null,
		reviewedBy: null,
		reviewedAt: 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 GrantApplicationDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createGrantApplicationDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/grant-application/v1/gen/controller.ts
const GrantApplicationController = PHDocumentController.forDocumentModel(GrantApplication);
//#endregion
//#region document-models/grant-application/v1/hooks.ts
/** Hook to get a GrantApplication document by its id */
function useGrantApplicationDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isGrantApplicationDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected GrantApplication document */
function useSelectedGrantApplicationDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsGrantApplicationDocument(document);
	return [document, dispatch];
}
/** Hook to get all GrantApplication documents in the selected drive */
function useGrantApplicationDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isGrantApplicationDocument);
}
/** Hook to get all GrantApplication documents in the selected folder */
function useGrantApplicationDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isGrantApplicationDocument);
}
//#endregion
export { GrantApplicationController as a, defaultGlobalState as c, useSelectedGrantApplicationDocument as i, defaultLocalState as l, useGrantApplicationDocumentsInSelectedDrive as n, createGrantApplicationDocument as o, useGrantApplicationDocumentsInSelectedFolder as r, createState as s, useGrantApplicationDocumentById as t, defaultPHState as u };

//# sourceMappingURL=grant-application-7PT_H477.mjs.map