{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "title": "Nitrite Data Exchange Format",
    "description": "The data format for importing and exporting data out of Nitrite database.",
    "properties": {
        "collections": {
            "type": "array",
            "title": "List of all Nitrite Collections",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "title": "Name of the Collection"
                    },
                    "indices": {
                        "type": "array",
                        "title": "Indices",
                        "items": {
                            "type": "object",
                            "properties": {
                                "index": {
                                    "type": "object",
                                    "title": "Index",
                                    "properties": {
                                        "indexType": {
                                            "type": "string",
                                            "title": "Type of the Index"
                                        },
                                        "field": {
                                            "type": "string",
                                            "title": "Indexed field"
                                        },
                                        "collectionName": {
                                            "type": "string",
                                            "title": "Name of the Collection"
                                        }
                                    },
                                    "required": [
                                        "indexType",
                                        "field",
                                        "collectionName"
                                    ]
                                }
                            },
                            "required": [
                                "index"
                            ]
                        }
                    },
                    "data": {
                        "type": "array",
                        "title": "Collection data format",
                        "items": {
                            "type": "object",
                            "title": "NitriteId and Document pairs",
                            "properties": {
                                "key": {
                                    "type": "object",
                                    "title": "NitriteId",
                                    "properties": {
                                        "idType": {
                                            "type": "string",
                                            "title": "Type of ObjectId"
                                        },
                                        "objectId": {
                                            "type": "object",
                                            "title": "ObjectId"
                                        }
                                    },
                                    "required": [
                                        "idType",
                                        "objectId"
                                    ]
                                },
                                "value": {
                                    "type": "object",
                                    "title": "Document"
                                }
                            },
                            "required": [
                                "key",
                                "value"
                            ]
                        }
                    }
                },
                "required": [
                    "name",
                    "indices",
                    "data"
                ]
            }
        },
        "repositories": {
            "type": "array",
            "title": "List of all Object Repositories",
            "items": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "title": "Type of the Object"
                    },
                    "indices": {
                        "type": "array",
                        "title": "Indices",
                        "items": {
                            "type": "object",
                            "properties": {
                                "index": {
                                    "type": "object",
                                    "title": "Index",
                                    "properties": {
                                        "indexType": {
                                            "type": "string",
                                            "title": "Type of the Index"
                                        },
                                        "field": {
                                            "type": "string",
                                            "title": "Indexed field"
                                        },
                                        "collectionName": {
                                            "type": "string",
                                            "title": "Internal name of the Object Repository"
                                        }
                                    },
                                    "required": [
                                        "indexType",
                                        "field",
                                        "collectionName"
                                    ]
                                }
                            },
                            "required": [
                                "index"
                            ]
                        }
                    },
                    "data": {
                        "type": "array",
                        "title": "Repository data format",
                        "items": {
                            "type": "object",
                            "title": "NitriteId and Document pairs",
                            "properties": {
                                "key": {
                                    "type": "object",
                                    "title": "NitriteId",
                                    "properties": {
                                        "idType": {
                                            "type": "string",
                                            "title": "Type of ObjectId"
                                        },
                                        "objectId": {
                                            "type": "object",
                                            "title": "ObjectId"
                                        }
                                    },
                                    "required": [
                                        "idType",
                                        "objectId"
                                    ]
                                },
                                "value": {
                                    "type": "object",
                                    "title": "Document"
                                }
                            },
                            "required": [
                                "key",
                                "value"
                            ]
                        }
                    }
                },
                "required": [
                    "type",
                    "indices",
                    "data"
                ]
            }
        }
    },
    "required": [
        "collections",
        "repositories"
    ]
}