import { p as createBaseState, t as PHDocumentController, v as defaultBaseState } from "./dist-uUUuTqM0.js";
import { a as utils, d as isBillingStatementDocument, l as assertIsBillingStatementDocument, t as BillingStatement } from "./module-CwMGazRD.js";
import { O as useSelectedDocument, _ as useDocumentsInSelectedFolder, g as useDocumentsInSelectedDrive, p as useDocumentById } from "./dist-mx7YTOSV.js";
//#region document-models/billing-statement/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		contributor: null,
		dateIssued: "2025-06-10T15:42:17.873Z",
		dateDue: "2025-06-10T15:42:17.873Z",
		lineItems: [],
		status: "DRAFT",
		currency: "",
		totalCash: 0,
		totalPowt: 0,
		notes: ""
	};
}
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 BillingStatementDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createBillingStatementDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/billing-statement/v1/gen/controller.ts
const BillingStatementController = PHDocumentController.forDocumentModel(BillingStatement);
//#endregion
//#region document-models/billing-statement/v1/hooks.ts
/** Hook to get a BillingStatement document by its id */
function useBillingStatementDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isBillingStatementDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected BillingStatement document */
function useSelectedBillingStatementDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsBillingStatementDocument(document);
	return [document, dispatch];
}
/** Hook to get all BillingStatement documents in the selected drive */
function useBillingStatementDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isBillingStatementDocument);
}
/** Hook to get all BillingStatement documents in the selected folder */
function useBillingStatementDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isBillingStatementDocument);
}
//#endregion
export { BillingStatementController as a, defaultGlobalState as c, useSelectedBillingStatementDocument as i, defaultLocalState as l, useBillingStatementDocumentsInSelectedDrive as n, createBillingStatementDocument as o, useBillingStatementDocumentsInSelectedFolder as r, createState as s, useBillingStatementDocumentById as t, defaultPHState as u };

//# sourceMappingURL=billing-statement-BYzQYDc9.js.map