[
    {
        "id": "questdb-examples-tab",
        "type": "tab",
        "label": "QuestDB Examples",
        "disabled": false,
        "info": "Complete examples for node-red-contrib-questdb.\nMake sure QuestDB is running on localhost:9000 before testing."
    },
    {
        "id": "comment-header",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "=== QuestDB Node-RED Examples ===",
        "info": "Comprehensive examples covering all features.\nClick inject nodes to test each scenario.",
        "x": 200,
        "y": 40
    },
    {
        "id": "comment-basic",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Basic Examples ---",
        "info": "",
        "x": 140,
        "y": 100
    },
    {
        "id": "inject-direct",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Structured data",
        "props": [
            {"p": "topic", "vt": "str"},
            {"p": "payload"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "sensors",
        "payload": "{}",
        "payloadType": "json",
        "x": 150,
        "y": 160,
        "wires": [["function-basic"]]
    },
    {
        "id": "function-basic",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Basic sensor data",
        "func": "msg.payload = {\n    symbols: {\n        device_id: \"sensor_001\",\n        location: \"warehouse\"\n    },\n    columns: {\n        temperature: 23.5,\n        humidity: 65.2,\n        pressure: 1013.25\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 360,
        "y": 160,
        "wires": [["questdb-write-basic"]]
    },
    {
        "id": "questdb-write-basic",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write to QuestDB",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 570,
        "y": 160,
        "wires": [["debug-basic"]]
    },
    {
        "id": "debug-basic",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 750,
        "y": 160
    },
    {
        "id": "inject-simple",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Simple numeric value",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "cpu_usage",
        "payload": "45.7",
        "payloadType": "num",
        "x": 170,
        "y": 220,
        "wires": [["questdb-write-basic"]]
    },
    {
        "id": "comment-types",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Explicit Column Types (int, long, double, decimal) ---",
        "info": "",
        "x": 240,
        "y": 300
    },
    {
        "id": "inject-explicit-types",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Explicit types",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "typed_data",
        "payload": "{}",
        "payloadType": "json",
        "x": 150,
        "y": 360,
        "wires": [["function-explicit-types"]]
    },
    {
        "id": "function-explicit-types",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Explicit type specification",
        "func": "msg.payload = {\n    symbols: {\n        device_id: \"sensor_001\"\n    },\n    columns: {\n        // Explicit integer (32-bit)\n        count: { value: 42, type: 'int' },\n        \n        // Explicit long (64-bit)\n        total_bytes: { value: 9876543210, type: 'long' },\n        \n        // Explicit float (32-bit)\n        temperature: { value: 23.456, type: 'float' },\n        \n        // Explicit double (64-bit, higher precision)\n        precise_value: { value: 3.141592653589793, type: 'double' },\n        \n        // Decimal (arbitrary precision)\n        price: { value: '123.45', type: 'decimal' },\n        \n        // Decimal with mantissa and scale\n        exact_amount: { mantissa: 12345, scale: 2, type: 'decimal' },\n        \n        // Auto-detected types (default behavior)\n        auto_number: 100.5,\n        auto_string: \"hello\",\n        auto_boolean: true\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 400,
        "y": 360,
        "wires": [["questdb-write-types", "debug-types"]]
    },
    {
        "id": "questdb-write-types",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write typed data",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 630,
        "y": 360,
        "wires": [["debug-types-result"]]
    },
    {
        "id": "debug-types",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Payload",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 630,
        "y": 320
    },
    {
        "id": "debug-types-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 830,
        "y": 360
    },
    {
        "id": "comment-arrays",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Array Columns ---",
        "info": "",
        "x": 150,
        "y": 440
    },
    {
        "id": "inject-arrays",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Array data",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "array_data",
        "payload": "{}",
        "payloadType": "json",
        "x": 140,
        "y": 500,
        "wires": [["function-arrays"]]
    },
    {
        "id": "function-arrays",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Array columns",
        "func": "msg.payload = {\n    symbols: {\n        sensor_id: \"multi_sensor_001\"\n    },\n    columns: {\n        // Auto-detected array (elements determine type)\n        readings: [1.5, 2.3, 3.7, 4.1, 5.9],\n        \n        // Explicit double array\n        temperatures: { \n            value: [22.1, 23.4, 21.8, 24.2], \n            type: 'array', \n            elementType: 'double' \n        },\n        \n        // Explicit long array\n        timestamps_micro: { \n            value: [1704067200000000, 1704067260000000, 1704067320000000], \n            type: 'array', \n            elementType: 'long' \n        },\n        \n        // String array\n        tags: [\"critical\", \"production\", \"monitored\"],\n        \n        // Boolean array\n        flags: [true, false, true, true]\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 350,
        "y": 500,
        "wires": [["questdb-write-arrays", "debug-arrays"]]
    },
    {
        "id": "questdb-write-arrays",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write arrays",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 560,
        "y": 500,
        "wires": [["debug-arrays-result"]]
    },
    {
        "id": "debug-arrays",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Array payload",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 570,
        "y": 460
    },
    {
        "id": "debug-arrays-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 750,
        "y": 500
    },
    {
        "id": "inject-time-series-array",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Time series batch",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "batch_readings",
        "payload": "{}",
        "payloadType": "json",
        "x": 160,
        "y": 560,
        "wires": [["function-time-series"]]
    },
    {
        "id": "function-time-series",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Multiple readings as arrays",
        "func": "// Store multiple readings from a sampling window\nmsg.payload = {\n    symbols: {\n        device_id: \"vibration_sensor_001\",\n        location: \"motor_housing\"\n    },\n    columns: {\n        // 100 samples at 1kHz for vibration analysis\n        x_axis: Array.from({length: 100}, () => (Math.random() - 0.5) * 10),\n        y_axis: Array.from({length: 100}, () => (Math.random() - 0.5) * 10),\n        z_axis: Array.from({length: 100}, () => (Math.random() - 0.5) * 10),\n        \n        // FFT frequency bins\n        fft_magnitudes: { \n            value: Array.from({length: 50}, () => Math.random() * 100),\n            type: 'array',\n            elementType: 'double'\n        },\n        \n        // Statistics\n        sample_count: { value: 100, type: 'int' },\n        sample_rate_hz: { value: 1000, type: 'int' }\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 410,
        "y": 560,
        "wires": [["questdb-write-arrays"]]
    },
    {
        "id": "comment-timestamps",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Timestamp Formats ---",
        "info": "",
        "x": 160,
        "y": 640
    },
    {
        "id": "inject-ts-ms",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Milliseconds",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "timestamp_test",
        "payload": "{}",
        "payloadType": "json",
        "x": 150,
        "y": 700,
        "wires": [["function-ts-ms"]]
    },
    {
        "id": "function-ts-ms",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Epoch milliseconds",
        "func": "msg.payload = {\n    symbols: { format: \"milliseconds\" },\n    columns: { value: 100 },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 370,
        "y": 700,
        "wires": [["questdb-write-ts"]]
    },
    {
        "id": "inject-ts-iso",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "ISO string",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "timestamp_test",
        "payload": "{}",
        "payloadType": "json",
        "x": 140,
        "y": 740,
        "wires": [["function-ts-iso"]]
    },
    {
        "id": "function-ts-iso",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "ISO 8601 string",
        "func": "msg.payload = {\n    symbols: { format: \"iso_string\" },\n    columns: { value: 200 },\n    timestamp: new Date().toISOString()\n};\nreturn msg;",
        "outputs": 1,
        "x": 370,
        "y": 740,
        "wires": [["questdb-write-ts"]]
    },
    {
        "id": "inject-ts-date",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Date object",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "timestamp_test",
        "payload": "{}",
        "payloadType": "json",
        "x": 140,
        "y": 780,
        "wires": [["function-ts-date"]]
    },
    {
        "id": "function-ts-date",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Date object",
        "func": "msg.payload = {\n    symbols: { format: \"date_object\" },\n    columns: { value: 300 },\n    timestamp: new Date()\n};\nreturn msg;",
        "outputs": 1,
        "x": 360,
        "y": 780,
        "wires": [["questdb-write-ts"]]
    },
    {
        "id": "inject-ts-auto",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Auto (server time)",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "timestamp_test",
        "payload": "{}",
        "payloadType": "json",
        "x": 160,
        "y": 820,
        "wires": [["function-ts-auto"]]
    },
    {
        "id": "function-ts-auto",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "No timestamp",
        "func": "msg.payload = {\n    symbols: { format: \"auto_now\" },\n    columns: { value: 400 }\n    // No timestamp - uses server time\n};\nreturn msg;",
        "outputs": 1,
        "x": 370,
        "y": 820,
        "wires": [["questdb-write-ts"]]
    },
    {
        "id": "questdb-write-ts",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 550,
        "y": 760,
        "wires": [["debug-ts-result"]]
    },
    {
        "id": "debug-ts-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 710,
        "y": 760
    },
    {
        "id": "comment-mapper",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Mapper Node Examples ---",
        "info": "",
        "x": 170,
        "y": 900
    },
    {
        "id": "inject-mapper-basic",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Raw sensor data",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "raw_reading",
        "payload": "{\"device\":\"temp_sensor_01\",\"reading\":22.7,\"battery\":85,\"ts\":0}",
        "payloadType": "json",
        "x": 160,
        "y": 960,
        "wires": [["function-mapper-ts"]]
    },
    {
        "id": "function-mapper-ts",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Add timestamp",
        "func": "msg.payload.ts = Date.now();\nreturn msg;",
        "outputs": 1,
        "x": 360,
        "y": 960,
        "wires": [["mapper-basic"]]
    },
    {
        "id": "mapper-basic",
        "type": "questdb-mapper",
        "z": "questdb-examples-tab",
        "name": "Map to ILP",
        "tableName": "temperature_readings",
        "timestampField": "payload.ts",
        "symbolMappings": [
            {"source": "payload.device", "target": "device_id"}
        ],
        "columnMappings": [
            {"source": "payload.reading", "target": "temperature", "type": "double"},
            {"source": "payload.battery", "target": "battery_level", "type": "integer"}
        ],
        "x": 550,
        "y": 960,
        "wires": [["debug-mapper-out", "questdb-write-mapper"]]
    },
    {
        "id": "debug-mapper-out",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Mapped output",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 760,
        "y": 920
    },
    {
        "id": "questdb-write-mapper",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write mapped",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 760,
        "y": 960,
        "wires": [["debug-mapper-result"]]
    },
    {
        "id": "debug-mapper-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 950,
        "y": 960
    },
    {
        "id": "inject-mapper-arrays",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Data with arrays",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "array_reading",
        "payload": "{\"sensor\":\"multi_01\",\"values\":[1.1,2.2,3.3,4.4],\"labels\":[\"a\",\"b\",\"c\"],\"ts\":0}",
        "payloadType": "json",
        "x": 160,
        "y": 1020,
        "wires": [["function-mapper-arrays-ts"]]
    },
    {
        "id": "function-mapper-arrays-ts",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Add timestamp",
        "func": "msg.payload.ts = Date.now();\nreturn msg;",
        "outputs": 1,
        "x": 360,
        "y": 1020,
        "wires": [["mapper-arrays"]]
    },
    {
        "id": "mapper-arrays",
        "type": "questdb-mapper",
        "z": "questdb-examples-tab",
        "name": "Map arrays",
        "tableName": "array_readings",
        "timestampField": "payload.ts",
        "symbolMappings": [
            {"source": "payload.sensor", "target": "sensor_id"}
        ],
        "columnMappings": [
            {"source": "payload.values", "target": "measurements", "type": "array_double"},
            {"source": "payload.labels", "target": "tags", "type": "array_string"}
        ],
        "x": 550,
        "y": 1020,
        "wires": [["debug-mapper-out", "questdb-write-mapper"]]
    },
    {
        "id": "comment-iot",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- IoT Protocol Examples ---",
        "info": "",
        "x": 170,
        "y": 1100
    },
    {
        "id": "inject-mqtt",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "MQTT-style message",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "home/livingroom/temperature",
        "payload": "22.5",
        "payloadType": "num",
        "x": 170,
        "y": 1160,
        "wires": [["function-mqtt"]]
    },
    {
        "id": "function-mqtt",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Transform MQTT to ILP",
        "func": "// Parse MQTT topic: home/livingroom/temperature\nconst parts = msg.topic.split('/');\nconst location = parts[1] || 'unknown';\nconst measurement = parts[2] || 'value';\n\nmsg.topic = 'mqtt_sensors';\nmsg.payload = {\n    symbols: {\n        location: location,\n        measurement_type: measurement\n    },\n    columns: {\n        value: msg.payload\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 410,
        "y": 1160,
        "wires": [["questdb-write-iot", "debug-iot"]]
    },
    {
        "id": "inject-modbus",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Modbus registers",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "plc_data",
        "payload": "{\"unitId\":1,\"registers\":[100,200,300,400],\"address\":40001}",
        "payloadType": "json",
        "x": 160,
        "y": 1220,
        "wires": [["function-modbus"]]
    },
    {
        "id": "function-modbus",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Transform Modbus to ILP",
        "func": "const regs = msg.payload.registers;\nmsg.topic = 'modbus_data';\nmsg.payload = {\n    symbols: {\n        unit_id: String(msg.payload.unitId),\n        base_address: String(msg.payload.address)\n    },\n    columns: {\n        // Store registers as an array\n        registers: regs,\n        register_count: { value: regs.length, type: 'int' }\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 420,
        "y": 1220,
        "wires": [["questdb-write-iot", "debug-iot"]]
    },
    {
        "id": "questdb-write-iot",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write IoT data",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 660,
        "y": 1190,
        "wires": [["debug-iot-result"]]
    },
    {
        "id": "debug-iot",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Transformed",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 660,
        "y": 1140
    },
    {
        "id": "debug-iot-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 850,
        "y": 1190
    },
    {
        "id": "comment-continuous",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Continuous Data Generation ---",
        "info": "",
        "x": 190,
        "y": 1300
    },
    {
        "id": "inject-continuous",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Every 1 second",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "metrics",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 1360,
        "wires": [["function-continuous"]]
    },
    {
        "id": "function-continuous",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Generate random metrics",
        "func": "msg.payload = {\n    symbols: {\n        host: \"server-\" + Math.floor(Math.random() * 3 + 1),\n        region: [\"us-east\", \"us-west\", \"eu-west\"][Math.floor(Math.random() * 3)]\n    },\n    columns: {\n        cpu: Math.random() * 100,\n        memory: Math.random() * 100,\n        disk_io: Math.random() * 1000,\n        connections: Math.floor(Math.random() * 1000),\n        avg_latency: Math.random() * 100\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 410,
        "y": 1360,
        "wires": [["questdb-write-continuous"]]
    },
    {
        "id": "questdb-write-continuous",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write metrics",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 650,
        "y": 1360,
        "wires": [["debug-continuous"]]
    },
    {
        "id": "debug-continuous",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 850,
        "y": 1360
    },
    {
        "id": "comment-edge",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Edge Cases ---",
        "info": "",
        "x": 140,
        "y": 1440
    },
    {
        "id": "inject-edge-null",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Null/undefined handling",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "edge_cases",
        "payload": "{}",
        "payloadType": "json",
        "x": 180,
        "y": 1500,
        "wires": [["function-edge-null"]]
    },
    {
        "id": "function-edge-null",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Test null handling",
        "func": "msg.payload = {\n    symbols: {\n        test_type: \"null_values\",\n        nullable_symbol: null,  // Skipped\n        valid_symbol: \"present\"\n    },\n    columns: {\n        valid_value: 42,\n        null_value: null,      // Skipped\n        undefined_value: undefined,  // Skipped\n        zero_value: 0,         // Included\n        empty_string: \"\",      // Included\n        false_boolean: false,  // Included\n        empty_array: []        // Included\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 410,
        "y": 1500,
        "wires": [["questdb-write-edge", "debug-edge"]]
    },
    {
        "id": "inject-edge-special",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Special numeric values",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "edge_cases",
        "payload": "{}",
        "payloadType": "json",
        "x": 180,
        "y": 1560,
        "wires": [["function-edge-special"]]
    },
    {
        "id": "function-edge-special",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Test special numbers",
        "func": "msg.payload = {\n    symbols: {\n        test_type: \"special_numbers\"\n    },\n    columns: {\n        zero: 0,\n        negative_zero: -0,\n        very_small: 0.000000001,\n        very_large: 999999999999.999,\n        max_safe_int: { value: Number.MAX_SAFE_INTEGER, type: 'long' },\n        precise_decimal: { value: '123456789.123456789', type: 'decimal' }\n        // Note: Infinity and NaN are skipped\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 420,
        "y": 1560,
        "wires": [["questdb-write-edge", "debug-edge"]]
    },
    {
        "id": "questdb-write-edge",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write edge cases",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 680,
        "y": 1530,
        "wires": [["debug-edge-result"]]
    },
    {
        "id": "debug-edge",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Payload",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 680,
        "y": 1480
    },
    {
        "id": "debug-edge-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 870,
        "y": 1530
    },
    {
        "id": "comment-type-router",
        "type": "comment",
        "z": "questdb-examples-tab",
        "name": "--- Type Router Examples ---",
        "info": "",
        "x": 170,
        "y": 1620
    },
    {
        "id": "inject-type-router-int",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Integer value",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "type_test",
        "payload": "42",
        "payloadType": "num",
        "x": 150,
        "y": 1680,
        "wires": [["type-router-example"]]
    },
    {
        "id": "inject-type-router-float",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Float value",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "type_test",
        "payload": "23.5",
        "payloadType": "num",
        "x": 140,
        "y": 1720,
        "wires": [["type-router-example"]]
    },
    {
        "id": "inject-type-router-bool",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "Boolean value",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "type_test",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 1760,
        "wires": [["type-router-example"]]
    },
    {
        "id": "inject-type-router-string",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "String value",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "type_test",
        "payload": "hello world",
        "payloadType": "str",
        "x": 150,
        "y": 1800,
        "wires": [["type-router-example"]]
    },
    {
        "id": "type-router-example",
        "type": "questdb-type-router",
        "z": "questdb-examples-tab",
        "name": "Route by type",
        "x": 360,
        "y": 1720,
        "wires": [
            ["function-int-handler"],
            ["function-float-handler"],
            ["function-bool-handler"],
            ["function-string-handler"]
        ]
    },
    {
        "id": "function-int-handler",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Handle Integer",
        "func": "msg.payload = {\n    symbols: {\n        data_type: \"integer\"\n    },\n    columns: {\n        int_value: { value: msg.payload, type: 'int' }\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 570,
        "y": 1660,
        "wires": [["questdb-write-type-router"]]
    },
    {
        "id": "function-float-handler",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Handle Float",
        "func": "msg.payload = {\n    symbols: {\n        data_type: \"float\"\n    },\n    columns: {\n        float_value: { value: msg.payload, type: 'double' }\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 560,
        "y": 1700,
        "wires": [["questdb-write-type-router"]]
    },
    {
        "id": "function-bool-handler",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Handle Boolean",
        "func": "msg.payload = {\n    symbols: {\n        data_type: \"boolean\"\n    },\n    columns: {\n        bool_value: msg.payload\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 570,
        "y": 1740,
        "wires": [["questdb-write-type-router"]]
    },
    {
        "id": "function-string-handler",
        "type": "function",
        "z": "questdb-examples-tab",
        "name": "Handle String",
        "func": "msg.payload = {\n    symbols: {\n        data_type: \"string\"\n    },\n    columns: {\n        string_value: msg.payload\n    },\n    timestamp: Date.now()\n};\nreturn msg;",
        "outputs": 1,
        "x": 570,
        "y": 1780,
        "wires": [["questdb-write-type-router"]]
    },
    {
        "id": "questdb-write-type-router",
        "type": "questdb",
        "z": "questdb-examples-tab",
        "name": "Write typed data",
        "questdb": "questdb-config-examples",
        "autoFlush": true,
        "flushInterval": 1000,
        "x": 790,
        "y": 1720,
        "wires": [["debug-type-router-result"]]
    },
    {
        "id": "debug-type-router-result",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Result",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.success",
        "statusType": "auto",
        "x": 1000,
        "y": 1720
    },
    {
        "id": "inject-type-router-string-num",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "String number",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "type_test",
        "payload": "123.45",
        "payloadType": "str",
        "x": 150,
        "y": 1840,
        "wires": [["type-router-conversion"]]
    },
    {
        "id": "inject-type-router-string-bool",
        "type": "inject",
        "z": "questdb-examples-tab",
        "name": "String boolean",
        "props": [
            {"p": "payload"},
            {"p": "topic", "vt": "str"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "type_test",
        "payload": "true",
        "payloadType": "str",
        "x": 150,
        "y": 1880,
        "wires": [["type-router-conversion"]]
    },
    {
        "id": "type-router-conversion",
        "type": "questdb-type-router",
        "z": "questdb-examples-tab",
        "name": "Auto-convert strings",
        "x": 380,
        "y": 1860,
        "wires": [
            ["debug-converted-int"],
            ["debug-converted-float"],
            ["debug-converted-bool"],
            ["debug-converted-string"]
        ]
    },
    {
        "id": "debug-converted-int",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Integer",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 620,
        "y": 1820
    },
    {
        "id": "debug-converted-float",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Float",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 610,
        "y": 1860
    },
    {
        "id": "debug-converted-bool",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "Boolean",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 620,
        "y": 1900
    },
    {
        "id": "debug-converted-string",
        "type": "debug",
        "z": "questdb-examples-tab",
        "name": "String",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 620,
        "y": 1940
    },
    {
        "id": "questdb-config-examples",
        "type": "questdb-config",
        "name": "Local QuestDB",
        "protocol": "http",
        "host": "localhost",
        "port": "9000",
        "tlsVerify": true,
        "tlsCa": "",
        "autoFlush": true,
        "autoFlushRows": "75000",
        "autoFlushInterval": "1000",
        "requestTimeout": "10000",
        "retryTimeout": "10000",
        "initBufSize": "65536",
        "maxBufSize": "104857600",
        "useAuth": false,
        "authType": "basic"
    }
]
