{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "items": {
            "type": "array",
            "items": {
                "title": "Integration",
                "description": "Schema for a single Integration",
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "integrationId": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "applicationId": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "creationDate": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "lastUpdated": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1024
                    },
                    "integrationType": {
                        "type": "string",
                        "enum": [
                            "googlePubSub",
                            "meridian",
                            "mqtt",
                            "particle"
                        ]
                    },
                    "enabled": {
                        "type": "boolean"
                    },
                    "topics": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1024
                        }
                    },
                    "googlePubSubConfig": {
                        "type": "object",
                        "properties": {
                            "projectId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "keyJson": {
                                "type": "string",
                                "maxLength": 32767,
                                "minLength": 4
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "projectId",
                            "keyJson"
                        ]
                    },
                    "mqttConfig": {
                        "type": "object",
                        "properties": {
                            "clientId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "username": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "password": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "clean": {
                                "type": "boolean"
                            },
                            "port": {
                                "type": "number",
                                "minimum": 1,
                                "maximum": 65535
                            },
                            "protocol": {
                                "type": "string",
                                "enum": [
                                    "mqtt",
                                    "mqtts",
                                    "ws",
                                    "wss"
                                ]
                            },
                            "host": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "privateKey": {
                                "type": "string",
                                "maxLength": 32767,
                                "minLength": 4
                            },
                            "certificate": {
                                "type": "string",
                                "maxLength": 32767,
                                "minLength": 4
                            },
                            "caCertificate": {
                                "type": "string",
                                "maxLength": 32767,
                                "minLength": 4
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "port",
                            "protocol",
                            "host"
                        ]
                    },
                    "particleConfig": {
                        "type": "object",
                        "properties": {
                            "accessToken": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "productSlugOrId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "orgSlugOrId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "deviceNameOrId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "accessToken"
                        ]
                    },
                    "meridianConfig": {
                        "type": "object",
                        "properties": {
                            "authenticationToken": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "locationId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                            },
                            "assetUpdates": {
                                "type": "boolean"
                            },
                            "zoneUpdates": {
                                "type": "boolean"
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "authenticationToken",
                            "locationId"
                        ]
                    },
                    "status": {
                        "lastKeepAlive": {
                            "type": [
                                "number"
                            ]
                        },
                        "nextAttempt": {
                            "type": [
                                "number"
                            ]
                        },
                        "connectInfo": {
                            "type": "object",
                            "properties": {
                                "ts": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                }
                            }
                        },
                        "disconnectInfo": {
                            "type": "object",
                            "properties": {
                                "ts": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "error": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        },
        "count": {
            "type": "integer"
        },
        "totalCount": {
            "type": "integer"
        },
        "perPage": {
            "type": "integer"
        },
        "page": {
            "type": "integer"
        },
        "filter": {
            "type": "string"
        },
        "filterField": {
            "type": "string"
        },
        "sortField": {
            "type": "string"
        },
        "sortDirection": {
            "type": "string",
            "enum": [
                "asc",
                "desc",
                "ASC",
                "DESC",
                ""
            ]
        },
        "applicationId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        }
    }
}