export function formDataToObject(formData: FormData) {
    const obj: any = {};
    formData.forEach((value, key) => {
        if (value instanceof File) {
            obj[key] = value;
        } else {
            // Basic type conversion
            if (value === 'null' || value === '') {
                obj[key] = null;
            } else if (value === 'true') {
                obj[key] = true;
            } else if (value === 'false') {
                obj[key] = false;
            } else if (!isNaN(Number(value)) && value.trim() !== '' && !key.includes('_id')) {
                // Don't convert UUID-like IDs to numbers
                obj[key] = Number(value);
            } else {
                obj[key] = value;
            }
        }
    });
    return obj;
}
