{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "id": {
            "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"
        },
        "ownerId": {
            "type": "string",
            "pattern": "^[A-Fa-f\\d]{24}$"
        },
        "ownerType": {
            "type": "string",
            "enum": [
                "user",
                "organization"
            ]
        },
        "organizationName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
        },
        "organizationIconColor": {
            "type": "string",
            "maxLength": 64
        },
        "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
        },
        "description": {
            "type": "string",
            "maxLength": 1024
        },
        "endpointSlug": {
            "type": "string",
            "minLength": 4,
            "maxLength": 63,
            "pattern": "^[0-9a-z-]*$"
        },
        "expUserTokenCutoff": {
            "type": "string",
            "format": "date-time"
        },
        "endpointDefaultCors": {
            "type": "boolean"
        },
        "globals": {
            "type": "array",
            "maxItems": 100,
            "items": {
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "json": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 32767
                    },
                    "cloudOnly": {
                        "type": "boolean",
                        "default": false
                    },
                    "description": {
                        "type": "string",
                        "maxLength": 1024
                    }
                },
                "additionalProperties": false,
                "required": [
                    "key",
                    "json"
                ]
            }
        },
        "blobUrlTTL": {
            "type": "number",
            "minimum": 3600,
            "maximum": 604800
        },
        "summary": {
            "type": "object",
            "properties": {
                "apiTokenCount": {
                    "type": "number"
                },
                "dataTableCount": {
                    "type": "number"
                },
                "deviceCount": {
                    "type": "number"
                },
                "deviceRecipeCount": {
                    "type": "number"
                },
                "eventCount": {
                    "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"
                },
                "storageStats": {
                    "type": "object",
                    "properties": {
                        "count": {
                            "type": "number"
                        },
                        "size": {
                            "type": "number"
                        }
                    }
                },
                "webhookCount": {
                    "type": "number"
                }
            }
        },
        "ftueTracking": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                    },
                    "version": {
                        "type": "number"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "skipped",
                            "completed"
                        ]
                    }
                },
                "required": [
                    "name",
                    "version",
                    "status"
                ],
                "additionalProperties": false
            },
            "maxItems": 100
        },
        "archiveConfig": {
            "type": "object",
            "properties": {
                "directory": {
                    "type": "string",
                    "max": 255
                },
                "mode": {
                    "type": "string",
                    "enum": [
                        "all",
                        "whitelist",
                        "blacklist"
                    ]
                },
                "deviceIds": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "maxItems": 1000
                },
                "deviceTags": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "key": {
                                "type": "string",
                                "pattern": "^[0-9a-zA-Z_-]{1,255}$"
                            },
                            "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 255
                            }
                        },
                        "additionalProperties": false
                    },
                    "maxItems": 100
                },
                "includeDevices": {
                    "type": "boolean",
                    "default": true
                },
                "includeEvents": {
                    "type": "boolean",
                    "default": false
                },
                "includeDataTables": {
                    "type": "boolean",
                    "default": false
                },
                "dataTablesMode": {
                    "type": "string",
                    "enum": [
                        "all",
                        "whitelist",
                        "blacklist"
                    ]
                },
                "dataTableIds": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "pattern": "^[A-Fa-f\\d]{24}$"
                    },
                    "maxItems": 1000
                },
                "s3": {
                    "type": "object",
                    "properties": {
                        "bucket": {
                            "type": "string",
                            "max": 255
                        },
                        "accessKeyId": {
                            "type": "string",
                            "min": 4,
                            "max": 128
                        },
                        "secretAccessKey": {
                            "type": "string",
                            "min": 4,
                            "max": 128
                        },
                        "region": {
                            "type": "string",
                            "max": 128
                        }
                    },
                    "required": [
                        "bucket",
                        "accessKeyId",
                        "secretAccessKey",
                        "region"
                    ],
                    "additionalProperties": false
                },
                "gcs": {
                    "type": "object",
                    "properties": {
                        "projectId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1024
                        },
                        "keyJson": {
                            "type": "string",
                            "maxLength": 32767,
                            "minLength": 4
                        },
                        "bucket": {
                            "type": "string",
                            "max": 255
                        }
                    },
                    "required": [
                        "projectId",
                        "keyJson",
                        "bucket"
                    ],
                    "additionalProperties": false
                },
                "azure": {
                    "type": "object",
                    "properties": {
                        "account": {
                            "type": "string",
                            "min": 3,
                            "max": 24
                        },
                        "accountKey": {
                            "type": "string",
                            "max": 255
                        },
                        "bucket": {
                            "type": "string",
                            "min": 3,
                            "max": 63
                        }
                    },
                    "required": [
                        "account",
                        "accountKey",
                        "bucket"
                    ],
                    "additionalProperties": false
                }
            },
            "additionalProperties": false
        }
    }
}