interface ResourceProperty {
	name: string;
	id: string;
}

interface Resource {
	id: number;
	name: string;
	properties: ResourceProperty[];
	inventory_limit: number;
	choice_based: boolean;
}

// Extend the window object to include gpi_inventory_page_strings
interface Window {
	jQuery: JQueryStatic
	gpi_inventory_page_strings: {
		nonce: string;
		resources: Record<string, Resource>;
	};
	fieldSettings: { [fieldType: string]: string }
	SetFieldProperty: (name: string, value: any) => void
	GetInputType: ( field: GravityFormsField ) => string
	ajaxurl: string
	GPI_ADMIN: {
		nonce: string
		conditionalLogicSupported: '1' | ''
		strings: { [key: string]: string }
		resources: { [id: number]: Resource }
		supportedInputTypes: string[]
		supportedFieldTypes: { [fieldType: string]: true | string[] }
		choiceInputTypes: string[]
		alwaysShowInventoryLimitInEditor: boolean
		gravityPerksIconUrl: string
	}
	field: GravityFormsField
	form: GravityFormsForm
	has_entry(fieldId: string | number): boolean
	gform: {
    	addFilter: Function
		addAction: Function
		applyFilters: Function
		doAction: Function
		tools: {
			debounce: Function;
			defaultFor: Function;
			getFocusable: Function;
			htmlToElement: Function;
			elementToHTML: Function;
			convertElements: Function;
			delegate: Function;
			getClosest: Function;
			getNodes: Function;
			mergeObjects: Function;
			setAttr: Function;
			isRtl: Function;
			isIE: Function;
			trigger: Function;
			uniqueId: Function;
			visible: Function;
			stripSlashes: Function;
			getCookie: Function;
			setCookie: Function;
			removeCookie: Function;
		}
	}
	gformCalculateTotalPrice: Function
	GPIProperties: any // typed as any as modules can't be imported in ambient declarations
	GPIConditionalLogic: any // typed as any as modules can't be imported in ambient declarations
	gf_matches_operation: Function
	gf_input_change: Function
	GPIConditionalLogicFormAdminInstance: any
}
