{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "items": {
            "type": "array",
            "items": {
                "title": "Organization",
                "description": "Schema for a single Organization",
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "orgId": {
                        "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": 255
                    },
                    "description": {
                        "type": "string",
                        "maxLength": 32767
                    },
                    "members": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "userId": {
                                    "type": "string",
                                    "pattern": "^[A-Fa-f\\d]{24}$"
                                },
                                "firstName": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1024
                                },
                                "lastName": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1024
                                },
                                "email": {
                                    "type": "string",
                                    "format": "email",
                                    "maxLength": 1024
                                },
                                "avatarUrl": {
                                    "type": "string",
                                    "format": "url"
                                },
                                "role": {
                                    "type": "string",
                                    "enum": [
                                        "admin",
                                        "edit",
                                        "collaborate",
                                        "view",
                                        "none"
                                    ]
                                },
                                "applicationRoles": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "resourceId": {
                                                "type": "string",
                                                "pattern": "^[A-Fa-f\\d]{24}$"
                                            },
                                            "role": {
                                                "type": "string",
                                                "enum": [
                                                    "collaborate",
                                                    "view",
                                                    "none"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "resourceId",
                                            "role"
                                        ],
                                        "additionalProperties": false
                                    },
                                    "maxItems": 1000
                                },
                                "dashboardRoles": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "resourceId": {
                                                "type": "string",
                                                "pattern": "^[A-Fa-f\\d]{24}$"
                                            },
                                            "role": {
                                                "type": "string",
                                                "enum": [
                                                    "collaborate",
                                                    "view",
                                                    "none"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "resourceId",
                                            "role"
                                        ],
                                        "additionalProperties": false
                                    },
                                    "maxItems": 1000
                                }
                            }
                        }
                    },
                    "limits": {
                        "apitoken": {
                            "type": "number"
                        },
                        "application": {
                            "type": "number"
                        },
                        "applicationkey": {
                            "type": "number"
                        },
                        "dashboard": {
                            "type": "number"
                        },
                        "datatable": {
                            "type": "number"
                        },
                        "device": {
                            "type": "number"
                        },
                        "devicerecipe": {
                            "type": "number"
                        },
                        "experiencedomain": {
                            "type": "number"
                        },
                        "experienceendpoint": {
                            "type": "number"
                        },
                        "experiencegroup": {
                            "type": "number"
                        },
                        "experienceslug": {
                            "type": "number"
                        },
                        "experienceuser": {
                            "type": "number"
                        },
                        "experienceversion": {
                            "type": "number"
                        },
                        "experienceview": {
                            "type": "number"
                        },
                        "file": {
                            "type": "number"
                        },
                        "flow": {
                            "type": "number"
                        },
                        "integration": {
                            "type": "number"
                        },
                        "notebook": {
                            "type": "number"
                        },
                        "webhook": {
                            "type": "number"
                        },
                        "dataTTL": {
                            "type": "number"
                        },
                        "member": {
                            "type": "number"
                        },
                        "payload": {
                            "type": "number"
                        },
                        "notebookMinutesPerRun": {
                            "type": "number"
                        },
                        "notebookMinutesPerMonth": {
                            "type": "number"
                        },
                        "notebookInParallel": {
                            "type": "number"
                        }
                    },
                    "summary": {
                        "type": "object",
                        "properties": {
                            "apiTokenCount": {
                                "type": "number"
                            },
                            "appCount": {
                                "type": "number"
                            },
                            "dashCount": {
                                "type": "number"
                            },
                            "dataTableCount": {
                                "type": "number"
                            },
                            "deviceCount": {
                                "type": "number"
                            },
                            "deviceRecipeCount": {
                                "type": "number"
                            },
                            "experienceDomainCount": {
                                "type": "number"
                            },
                            "experienceEndpointCount": {
                                "type": "number"
                            },
                            "experienceGroupCount": {
                                "type": "number"
                            },
                            "experienceSlugCount": {
                                "type": "number"
                            },
                            "experienceUserCount": {
                                "type": "number"
                            },
                            "experienceVersionCount": {
                                "type": "number"
                            },
                            "experienceViewCount": {
                                "type": "number"
                            },
                            "fileCount": {
                                "type": "number"
                            },
                            "flowCount": {
                                "type": "number"
                            },
                            "integrationCount": {
                                "type": "number"
                            },
                            "keyCount": {
                                "type": "number"
                            },
                            "memberCount": {
                                "type": "number"
                            },
                            "payloadCount": {
                                "title": "Payload Counts",
                                "description": "Schema for the result of a payload count request",
                                "type": "object",
                                "properties": {
                                    "mqttOut": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "mqttIn": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "dataTable": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "deviceState": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "deviceCommand": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "webhook": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "timer": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "event": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "virtualButton": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "deviceConnect": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "deviceDisconnect": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "endpoint": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    },
                                    "integration": {
                                        "type": "object",
                                        "patternProperties": {
                                            ".*": {
                                                "type": "number"
                                            }
                                        }
                                    }
                                }
                            },
                            "pendingInviteCount": {
                                "type": "number"
                            },
                            "storageStats": {
                                "type": "object",
                                "properties": {
                                    "count": {
                                        "type": "number"
                                    },
                                    "size": {
                                        "type": "number"
                                    }
                                }
                            },
                            "webhookCount": {
                                "type": "number"
                            }
                        }
                    },
                    "planId": {
                        "type": "string",
                        "maxLength": 1024
                    },
                    "billingEmail": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 1024
                    },
                    "subscriptionStatus": {
                        "type": "string",
                        "enum": [
                            "trialing",
                            "active",
                            "past_due",
                            "canceled",
                            "unpaid"
                        ]
                    },
                    "currentPeriodStart": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "currentPeriodEnd": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "isEnterprise": {
                        "type": "boolean"
                    },
                    "iconColor": {
                        "type": "string",
                        "maxLength": 64
                    },
                    "whitelistedEmailDomains": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "maxLength": 1024,
                            "minLength": 3
                        }
                    }
                }
            }
        },
        "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",
                ""
            ]
        }
    }
}