{
    "title": "InputData",
    "description": "A form widget for collecting user input and storing it in database tables. Use this widget to create data entry interfaces for manual input, configuration settings, user feedback, or any scenario requiring structured data collection. Supports various field types including text, numbers, dropdowns, checkboxes, textareas, and datetime pickers. Each field maps to a database column, enabling direct data persistence. Can display as a button-triggered modal or inline form.",
    "type": "object",
    "properties": {
        "title": {
            "title": "Title",
            "description": "The main heading displayed at the top of the form. Use to describe the form's purpose (e.g., 'Add New Device', 'Submit Feedback', 'Configuration Settings').",
            "order": 1,
            "type": "string"
        },
        "subTitle": {
            "title": "Subtitle",
            "description": "Secondary text displayed below the title. Use for instructions, context, or additional information about the form.",
            "order": 2,
            "type": "string"
        },
        "formButton": {
            "title": "Form Open Button",
            "description": "When enabled, shows a button that opens the form in a modal dialog when clicked. When disabled, the form fields are displayed directly in the widget area. Use button mode for space-constrained layouts or optional data entry.",
            "dataDrivenDisabled": true,
            "type": "boolean",
            "order": 3
        },
        "deleteButton": {
            "title": "Show Delete Button",
            "description": "When enabled, shows a delete button that allows users to remove existing entries.",
            "dataDrivenDisabled": true,
            "type": "boolean",
            "order": 4
        },
        "deleteFlagColumn": {
            "title": "Delete-Flag Column",
            "description": "The target table column used to mark records as deleted when the delete button is clicked. This MUST be a boolean column. If the target table has such a deleted_flag column, it should be specified here regardless of the delete button setting.",
            "dataDrivenDisabled": true,
            "type": "targetColumn",
            "order": 5
        },
        "deleteNavigationRoute": {
            "title": "Post-Delete Navigation",
            "description": "The destination path to route to after delete. Use for navigating to a home or main page.",
            "order": 6,
            "condition": {
                "relativePath": "../deleteButton",
                "showIfValueIn": [true]
            },
            "type": "string"
        },
        "variables": {
            "title": "Post-Delete Navigation Variables",
            "description": "Array of variable definitions for dynamic route segment substitution. Each variable has a label (used in the route string as {{label}}) and a value (the replacement text). Values can be static or bound to data columns for real-time updates.",
            "type": "array",
            "dataDrivenDisabled": true,
            "condition": {
                "relativePath": "../deleteButton",
                "showIfValueIn": [true]
            },
            "order": 7,
            "items": {
                "type": "object",
                "properties": {
                    "label": {
                        "title": "Label",
                        "description": "The variable name used in the route string. Reference this in your route using the {{label}} syntax. Use descriptive names like 'temperature', 'status', 'deviceName'.",
                        "type": "string",
                        "dataDrivenDisabled": true,
                        "order": 1
                    },
                    "value": {
                        "title": "Value",
                        "description": "The replacement text that will appear in place of {{label}} in the rendered output. Can be a static value or bound to a data column for dynamic updates.",
                        "type": "string",
                        "order": 2
                    }
                }
            }
        },
        "formFields": {
            "title": "Form Fields",
            "description": "Array of input fields that make up the form. Each field defines its type, validation rules, and target database column for storage. Fields are rendered in the order specified.",
            "type": "array",
            "order": 8,
            "dataDrivenDisabled": true,
            "items": {
                "type": "object",
                "properties": {
                    "label": {
                        "title": "Label",
                        "description": "The text label displayed next to this form field. Should clearly describe what data the user should enter.",
                        "type": "string",
                        "dataDrivenDisabled": true,
                        "required": true,
                        "order": 1
                    },
                    "type": {
                        "title": "Field Type",
                        "description": "The input control type: 'dropdown' for selection from predefined options, 'textfield' for single-line text, 'numberfield' for numeric values, 'checkbox' for boolean yes/no, 'textarea' for multi-line text, 'datetime' for date and time selection.",
                        "enum": ["dropdown", "textfield", "numberfield", "checkbox", "textarea", "datetime"],
                        "type": "string",
                        "dataDrivenDisabled": true,
                        "required": true,
                        "order": 2
                    },
                    "hiddenField": {
                        "title": "Hidden Field",
                        "type": "boolean",
                        "description": "When enabled, this field is hidden from users but its value (typically a default or data-bound value) is still submitted with the form. Useful for including metadata, timestamps, or user IDs automatically.",
                        "dataDrivenDisabled": true,
                        "order": 3
                    },
                    "required": {
                        "title": "Required",
                        "type": "boolean",
                        "description": "When enabled, users must fill out this field before the form can be submitted. The form will show a validation error if left empty. Ignored when a default value is provided.",
                        "dataDrivenDisabled": true,
                        "order": 4
                    },
                    "description": {
                        "title": "Hint Text",
                        "type": "string",
                        "description": "Helper text displayed below the field to guide users on what to enter. Use for format hints, examples, or clarifying instructions.",
                        "dataDrivenDisabled": true,
                        "order": 5
                    },
                    "targetColumn": {
                        "title": "Target Column",
                        "type": "targetColumn",
                        "description": "The database table and column where this field's value will be stored on form submission. Select from available tables and columns. All fields targeting the same table will be combined into a single row insert.",
                        "dataDrivenDisabled": true,
                        "required": true,
                        "order": 6
                    },
                    "preFilledValue": {
                        "title": "Pre-filled Value",
                        "description": "Pre-filled value for this field when the form loads. Can be a static value or bound to a data source.",
                        "type": "string",
                        "order": 7
                    },
                    "defaultValue": {
                        "title": "Default Value",
                        "description": "Default value for this field when the form loads. If the user does not provide a value, this default will be used. Can be a static value or bound to a data source.",
                        "type": "string",
                        "order": 8
                    },
                    "min": {
                        "title": "Minimum Value",
                        "type": "number",
                        "description": "The minimum allowed numeric value for numberfield types. Values below this will fail validation.",
                        "dataDrivenDisabled": true,
                        "condition": {
                            "relativePath": "../type",
                            "showIfValueIn": ["numberfield"]
                        },
                        "order": 9
                    },
                    "max": {
                        "title": "Maximum Value",
                        "type": "number",
                        "description": "The maximum allowed numeric value for numberfield types. Values above this will fail validation.",
                        "dataDrivenDisabled": true,
                        "condition": {
                            "relativePath": "../type",
                            "showIfValueIn": ["numberfield"]
                        },
                        "order": 10
                    },
                    "validation": {
                        "title": "Validation Regex",
                        "type": "string",
                        "description": "A regular expression pattern to validate text input (e.g., '^[A-Z]{2}[0-9]{4}$' for format like 'AB1234'). Leave empty to accept any text.",
                        "dataDrivenDisabled": true,
                        "condition": {
                            "relativePath": "../type",
                            "showIfValueIn": ["textfield"]
                        },
                        "order": 11
                    },
                    "values": {
                        "title": "Dropdown Values",
                        "type": "array",
                        "description": "The list of selectable options for dropdown field types. Each option has a display label and a stored value.",
                        "condition": {
                            "relativePath": "../type",
                            "showIfValueIn": ["dropdown"]
                        },
                        "items": {
                            "type": "object",
                            "properties": {
                                "displayLabel": {
                                    "title": "Display Label",
                                    "type": "string",
                                    "description": "The text shown to users in the dropdown list.",
                                    "required": true,
                                    "order": 1
                                },
                                "value": {
                                    "title": "Value",
                                    "type": "string",
                                    "description": "The actual value stored in the database when this option is selected. May differ from the display label.",
                                    "required": true,
                                    "order": 2
                                }
                            }
                        },
                        "order": 12
                    }
                }
            }
        }
    }
}
