//#region src/domains/run/utils/schema-validation.ts
/**
* Extract preview fields from a schema (fields marked with inPreview: true)
*/
function extractPreviewFields(schema) {
	const previewProperties = {};
	if (schema.properties) {
		for (const [key, prop] of Object.entries(schema.properties)) if (prop.inPreview === true) {
			const cleanProp = { ...prop };
			delete cleanProp.inPreview;
			previewProperties[key] = cleanProp;
		}
	}
	return {
		type: "object",
		properties: previewProperties,
		required: schema.required?.filter((field) => previewProperties[field])
	};
}
/**
* Extract full fields from a schema (all fields, with inPreview flags removed)
*/
function extractFullFields(schema) {
	const fullProperties = {};
	if (schema.properties) for (const [key, prop] of Object.entries(schema.properties)) {
		const cleanProp = { ...prop };
		delete cleanProp.inPreview;
		fullProperties[key] = cleanProp;
	}
	return {
		type: "object",
		properties: fullProperties,
		required: schema.required
	};
}

//#endregion
export { extractFullFields, extractPreviewFields };