{
        "title": "Biometric Devices",
        "modulePath": "biometric-devices",
        "dataSources": {
            "main": {
                "table": "biometric_devices",
                "orderBy": "createdAt DESC"
            },
            "logs": {
                "table": "biometric_device_logs",
                "orderBy": "createdAt DESC"
            },
            "branches": {
                "table": "branches",
                "displayField": "name",
                "valueField": "branch_id"
            }
        },
        "header": [
            {
                "type": "button",
                "label": "Register Device",
                "formId": 631
            },
            {
                "type": "filter-select",
                "options": {
                    "data_column": "device_type",
                    "label": "Device Type",
                    "options": [
                        {"label": "All Types", "value": ""},
                        {"label": "F500 (Fingerprint)", "value": "F500"},
                        {"label": "M50 (Face + Temp)", "value": "M50"},
                        {"label": "M91 (Multi-modal)", "value": "M91"}
                    ]
                }
            },
            {
                "type": "filter-select",
                "options": {
                    "data_column": "is_online",
                    "label": "Status",
                    "options": [
                        {"label": "All", "value": ""},
                        {"label": "Online", "value": "true"},
                        {"label": "Offline", "value": "false"}
                    ]
                }
            },
            {
                "type": "filter-select",
                "options": {
                    "data_column": "approved",
                    "label": "Approval",
                    "options": [
                        {"label": "All", "value": ""},
                        {"label": "Approved", "value": "true"},
                        {"label": "Disabled", "value": "false"}
                    ]
                }
            },
            {
                "type": "button",
                "label": "Refresh",
                "icon": "fa-sync",
                "class": "btn btn-ghost",
                "action": "refresh",
                "ariaLabel": "Refresh device list"
            }
        ],
        "body": [
            {
                "type": "table",
                "id": "biometricDevicesTable",
                "options": {
                    "tableName": "biometric_devices",
                    "primaryKeyField": "biometric_device_id",
                    "showGlobalSearch": true,
                    "columnsToShow": [
                        "device_sn",
                        "name",
                        "device_type",
                        "branch_id",
                        "is_online",
                        "last_seen",
                        "approved",
                        "createdAt"
                    ],
                    "columnLabels": {
                        "device_sn": "Serial Number",
                        "name": "Device Name",
                        "device_type": "Type",
                        "branch_id": "Branch",
                        "is_online": "Status",
                        "last_seen": "Last Seen",
                        "approved": "Approved",
                        "createdAt": "Registered"
                    },
                    "columnFormatters": {
                        "is_online": {
                            "type": "badge",
                            "true": {"label": "Online", "class": "badge-success"},
                            "false": {"label": "Offline", "class": "badge-error"}
                        },
                        "approved": {
                            "type": "badge",
                            "true": {"label": "Enabled", "class": "badge-success"},
                            "false": {"label": "Disabled", "class": "badge-warning"}
                        },
                        "branch_id": {
                            "type": "lookup",
                            "dataSource": "branches"
                        }
                    },
                    "rowClick": "selectRecord",
                    "rowActions": [
                        {
                            "label": "View Details",
                            "icon": "fa-eye",
                            "class": "btn btn-info btn-xs",
                            "action": "openSelectedDetail",
                            "ariaLabel": "View device details"
                        },
                        {
                            "label": "View Logs",
                            "icon": "fa-list",
                            "class": "btn btn-ghost btn-xs",
                            "action": "biometric:view-logs",
                            "ariaLabel": "View device connection logs"
                        },
                        {
                            "label": "Disable",
                            "icon": "fa-ban",
                            "class": "btn btn-warning btn-xs",
                            "action": "biometric:toggle-approval",
                            "condition": "approved == true",
                            "confirm": "Disable this device? It will not be able to connect.",
                            "ariaLabel": "Disable device"
                        },
                        {
                            "label": "Enable",
                            "icon": "fa-check",
                            "class": "btn btn-success btn-xs",
                            "action": "biometric:toggle-approval",
                            "condition": "approved == false",
                            "confirm": "Enable this device?",
                            "ariaLabel": "Enable device"
                        },
                        {
                            "label": "Delete",
                            "icon": "fa-trash",
                            "class": "btn btn-error btn-xs",
                            "action": "delete",
                            "confirm": "Delete this device? This cannot be undone.",
                            "ariaLabel": "Delete device"
                        }
                    ]
                }
            }
        ],
        "detailModal": {
            "title": "Device Details",
            "size": "large",
            "tabs": [
                {
                    "id": "info",
                    "label": "Device Information",
                    "icon": "fa-info-circle",
                    "sections": [
                        {
                            "title": "Basic Information",
                            "layout": "two-column",
                            "fields": [
                                {
                                    "name": "device_sn",
                                    "label": "Device Serial Number",
                                    "type": "text",
                                    "required": true,
                                    "placeholder": "Enter device serial number",
                                    "helpText": "Physical serial number from the device hardware"
                                },
                                {
                                    "name": "name",
                                    "label": "Device Name",
                                    "type": "text",
                                    "required": true,
                                    "placeholder": "e.g., Main Entrance Scanner"
                                },
                                {
                                    "name": "device_type",
                                    "label": "Device Model",
                                    "type": "select",
                                    "required": true,
                                    "options": [
                                        {"label": "F500 - Fingerprint Scanner", "value": "F500"},
                                        {"label": "M50 - Face Recognition + Temperature", "value": "M50"},
                                        {"label": "M91 - Multi-modal Biometric", "value": "M91"}
                                    ]
                                },
                                {
                                    "name": "branch_id",
                                    "label": "Branch Location",
                                    "type": "lookup",
                                    "required": true,
                                    "dataSource": "branches",
                                    "helpText": "Select the branch where this device is installed"
                                },
                                {
                                    "name": "cloud_id",
                                    "label": "Cloud ID",
                                    "type": "text",
                                    "placeholder": "Optional cloud service identifier"
                                },
                                {
                                    "name": "approved",
                                    "label": "Device Approved",
                                    "type": "checkbox",
                                    "default": true,
                                    "helpText": "Disabled devices cannot connect to the system"
                                }
                            ]
                        },
                        {
                            "title": "Description",
                            "layout": "single-column",
                            "fields": [
                                {
                                    "name": "description",
                                    "label": "Notes",
                                    "type": "textarea",
                                    "rows": 3,
                                    "placeholder": "Additional notes about this device..."
                                }
                            ]
                        }
                    ]
                },
                {
                    "id": "status",
                    "label": "Status & Activity",
                    "icon": "fa-chart-line",
                    "sections": [
                        {
                            "title": "Connection Status",
                            "layout": "two-column",
                            "fields": [
                                {
                                    "name": "is_online",
                                    "label": "Current Status",
                                    "type": "badge",
                                    "readonly": true,
                                    "formatter": {
                                        "type": "badge",
                                        "true": {"label": "Online", "class": "badge-success"},
                                        "false": {"label": "Offline", "class": "badge-error"}
                                    }
                                },
                                {
                                    "name": "last_seen",
                                    "label": "Last Seen",
                                    "type": "datetime",
                                    "readonly": true
                                },
                                {
                                    "name": "websocket_session",
                                    "label": "Session ID",
                                    "type": "text",
                                    "readonly": true,
                                    "helpText": "WebSocket connection identifier"
                                },
                                {
                                    "name": "createdAt",
                                    "label": "Registered On",
                                    "type": "datetime",
                                    "readonly": true
                                }
                            ]
                        },
                        {
                            "title": "Recent Activity Logs",
                            "component": "data-grid",
                            "dataSource": "logs",
                            "filters": {
                                "biometric_device_id": "{biometric_device_id}"
                            },
                            "limit": 10,
                            "columns": [
                                {
                                    "field": "event_type",
                                    "label": "Event",
                                    "width": "150px"
                                },
                                {
                                    "field": "createdAt",
                                    "label": "Time",
                                    "width": "180px",
                                    "formatter": "datetime"
                                },
                                {
                                    "field": "details",
                                    "label": "Details",
                                    "formatter": "json"
                                }
                            ]
                        }
                    ]
                },
                {
                    "id": "settings",
                    "label": "Device Settings",
                    "icon": "fa-cog",
                    "sections": [
                        {
                            "title": "Configuration",
                            "layout": "single-column",
                            "fields": [
                                {
                                    "name": "settings",
                                    "label": "Device Settings (JSON)",
                                    "type": "json-editor",
                                    "helpText": "Advanced device configuration in JSON format",
                                    "placeholder": "{}"
                                }
                            ]
                        }
                    ]
                }
            ],
            "actions": [
                {
                    "label": "Save",
                    "icon": "fa-save",
                    "class": "btn btn-primary",
                    "action": "save",
                    "closeOnSuccess": true
                },
                {
                    "label": "Cancel",
                    "class": "btn btn-ghost",
                    "action": "close"
                }
            ]
        },
        "footer": [
            {
                "type": "button",
                "label": "Close",
                "onClick": "closeModal"
            }
        ]
    }