import { p as createBaseState, t as PHDocumentController, v as defaultBaseState } from "./dist-CYoGQ6PD.mjs";
import { a as utils, d as isGrantPoolDocument, l as assertIsGrantPoolDocument, t as GrantPool } from "./module-BMSfcjYx.mjs";
import { c as useDocumentsInSelectedDrive, l as useDocumentsInSelectedFolder, p as useSelectedDocument, s as useDocumentById } from "./dist-LFSG_0Q3.mjs";
//#region document-models/grant-pool/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		grantSystemRef: null,
		name: null,
		description: null,
		grantFundingMechanism: null,
		isOpen: false,
		openDate: null,
		closeDate: null,
		applicationsURI: null,
		governanceURI: null,
		attestationIssuersURI: null,
		requiredCredentials: [],
		totalGrantPoolSize: [],
		totalGrantPoolSizeInUSD: null,
		minGrant: [],
		maxGrant: [],
		email: null,
		image: null,
		coverImage: null,
		extensions: null,
		sameAs: [],
		code: null,
		briefingURI: null,
		eligibilityCriteria: null,
		evaluationCriteria: null,
		contextDocuments: [],
		reviewers: [],
		categories: [],
		ecosystems: [],
		tags: [],
		lifecycle: "DRAFT",
		submitter: null,
		publisher: null,
		lastVerifiedAt: null,
		verificationMethod: null,
		verifiedBy: null,
		governanceState: "PENDING",
		supersedes: null,
		claimedFromEntry: null,
		duplicateOf: 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 GrantPoolDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createGrantPoolDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/grant-pool/v1/gen/controller.ts
const GrantPoolController = PHDocumentController.forDocumentModel(GrantPool);
//#endregion
//#region document-models/grant-pool/v1/hooks.ts
/** Hook to get a GrantPool document by its id */
function useGrantPoolDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isGrantPoolDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected GrantPool document */
function useSelectedGrantPoolDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsGrantPoolDocument(document);
	return [document, dispatch];
}
/** Hook to get all GrantPool documents in the selected drive */
function useGrantPoolDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isGrantPoolDocument);
}
/** Hook to get all GrantPool documents in the selected folder */
function useGrantPoolDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isGrantPoolDocument);
}
//#endregion
//#region document-models/grant-pool/upgrades/versions.ts
const supportedVersions = [1];
const latestVersion = supportedVersions[0];
//#endregion
//#region document-models/grant-pool/upgrades/upgrade-manifest.ts
const grantPoolUpgradeManifest = {
	documentType: "rfp-hub/grant-pool",
	latestVersion,
	supportedVersions,
	upgrades: {}
};
//#endregion
export { useGrantPoolDocumentsInSelectedDrive as a, GrantPoolController as c, defaultGlobalState as d, defaultLocalState as f, useGrantPoolDocumentById as i, createGrantPoolDocument as l, latestVersion as n, useGrantPoolDocumentsInSelectedFolder as o, defaultPHState as p, supportedVersions as r, useSelectedGrantPoolDocument as s, grantPoolUpgradeManifest as t, createState as u };

//# sourceMappingURL=grant-pool-B5bEceKw.mjs.map