{
    "pluginAlias": "HomebridgeRollAppPlugin",
    "pluginType": "platform",
    "headerDisplay": "homebridge-rollapp creates window covering (or blind) accessories in HomeKit, providing control and status functions through the RollApp hub.",
    "footerDisplay": "For additional help and documentation please see the [developer page](https://github.com/pvdlg/homebridge-rollapp).",
    "singular": true,
    "schema": {
        "type": "object",
        "properties": {
            "auth": {
                "type": "object",
                "title": "Authentication",
                "properties": {
                    "username": {
                        "type": "string",
                        "title": "Username",
                        "required": true,
                        "description": "RollApp username."
                    },
                    "password": {
                        "type": "string",
                        "title": "Password",
                        "required": true,
                        "description": "RollApp password."
                    }
                }
            },
            "api" : {
                "type": "object",
                "title": "RollApp API connection",
                "properties": {
                    "hubSerial": {
                        "type": "string",
                        "title": "Hub Serial",
                        "required": true,
                        "description": "The RollApp Hub serial that can be found in the Device Status menu in the app."
                    },
                    "firebaseAPIKey": {
                        "type": "string",
                        "title": "Firebase API Key",
                        "required": false,
                        "description": "The API key to identify the RollApp Firebase backend. Used to obtain an authentication token."
                    },
                    "endpoint": {
                        "type": "string",
                        "title": "Endpoint",
                        "required": false,
                        "description": "The API endpoint. By default https://20230124t120606-dot-gaposa-prod.ew.r.appspot.com."
                    },
                    "clientId": {
                        "type": "string",
                        "title": "Client Id",
                        "required": false,
                        "description": "The Client Id passed in the Auth.client header."
                    },
                    "throttleInterval": {
                        "type": "number",
                        "title": "Throttle Interval",
                        "required": false,
                        "minimum": 0,
                        "description": "Minimum duration, in milliseconds, in between two API commands."
                    }
                }
            },
            "blinds": {
                "type": "array",
                "title": "Blinds",
                "items": {
                    "type": "object",
                    "title": "Blind",
                    "properties": {
                        "name": {
                            "type": "string",
                            "title": "Blind Name",
                            "required": true,
                            "placeholder": "e.g. Blinds",
                            "description": "Name you want to give this blind accessory in HomeKit. Each blind must have a unique name."
                        },
                        "transitionInterval": {
                            "type": "number",
                            "title": "Transition Interval",
                            "required": true,
                            "minimum": 0,
                            "maximum": 120,
                            "description": "Duration, in seconds, for this blind to move from up to down. Default: 30.0."
                        },
                        "responseLag": {
                            "type": "number",
                            "title": "Response Lag",
                            "required": true,
                            "description": "The duration, in milliseconds, beween an http API command success and the moment the motor starts. Default 1000."
                        },
                        "manufacturer": {
                            "type": "string",
                            "title": "Blind Manufacturer",
                            "required": false,
                            "placeholder": "e.g. SomeManufacturer",
                            "description": "Manufacturer name to assign to this blind."
                        },
                        "model": {
                            "type": "string",
                            "title": "Blind Model",
                            "required": false,
                            "placeholder": "e.g. SomeModel",
                            "description": "Model name to assign to this blind."
                        },
                        "bank": {
                            "type": "number",
                            "title": "Blind Bank",
                            "required": true,
                            "description": "Bank at which this blind is register."
                        },
                        "address": {
                            "type": "number",
                            "title": "Blind Address",
                            "required": true,
                            "description": "Address at which this blind is register."
                        }
                    }
                }
            }
        }
    },
    "layout": [
        {
            "key": "auth",
            "type": "section",
            "title": "Authentication",
            "items": [
                {
                    "items": [
                        "auth.username",
                        "auth.password"
                    ]
                }
            ]
        },
        {
            "key": "api",
            "type": "section",
            "title": "RollApp API connection",
            "items": [
                {
                    "items": [
                        "api.hubSerial",
                        "api.endpoint",
                        "api.firebaseAPIKey",
                        "api.clientId",
                        "api.throttleInterval"
                    ]
                }
            ]
        },
        {
            "key": "blinds",
            "type": "array",
            "name": " ",
            "description": "Provide the details of your blinds.",
            "orderable": true,
            "buttonText": "Add Blind",
            "items": [
                "blinds[].name",
                {
                    "key": "blinds[]",
                    "type": "section",
                    "title": "Blind Identification",
                    "items": [
                        {
                            "description": "These settings are mandatory and allow you to identify your blinds.",
                            "items": [
                                "blinds[].bank",
                                "blinds[].address",
                                "blinds[].transitionInterval",
                                "blinds[].responseLag"
                            ]
                        }
                    ]
                },
                {
                    "key": "blinds[]",
                    "type": "section",
                    "title": "Blind Information",
                    "expandable": true,
                    "expanded": false,
                    "items": [
                        {
                            "description": "These settings are optional and allow you to set additional information about your blinds.",
                            "items": [
                                "blinds[].manufacturer",
                                "blinds[].model",
                                "blinds[].serial"
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}
