{
    "$id": "https://raw.githubusercontent.com/edertone/TurboBuilder/master/TurboBuilder-Node/src/main/resources/json-schema/turbodepot.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "title": "turbodepot.json schema",
    "required": [
        "$schema",
        "depots",
        "sources"
    ],
    "additionalProperties": false,
    "properties": {
        "$schema": {
            "type": "string",
            "description": "Url to the json schema definition to validate this file",
            "enum": [
                "https://raw.githubusercontent.com/edertone/TurboBuilder/master/TurboBuilder-Node/src/main/resources/json-schema/turbodepot.schema.json"
            ]
        },
        "depots": {
            "type": "array",
            "description": "",
            "items": {
                "type": "object",
                "description": "",
                "required": [
                    "name",
                    "storageFolderPath",
                    "tmpFiles",
                    "localizedFiles",
                    "logs",
                    "objects",
                    "googleDrive",
                    "users"
                ],
                "additionalProperties": false,
                "properties": {
                    "name": {
                        "type": "string",
                        "description": ""
                    },
                    "storageFolderPath": {
                        "type": "string",
                        "description": "The full file system path to the root of the storage folder (if used)"
                    },
                    "tmpFiles": {
                        "type": "object",
                        "description": "Defines the setup for the storage of temporary files into this depot instance",
                        "required": [
                            "source"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "source": {
                                "type": "string",
                                "description": "The name for a source that will be used to store and read the temporary files"
                            }
                        }
                    },
                    "localizedFiles": {
                        "type": "object",
                        "description": "Defines the setup for the storage of localized files into this depot instance",
                        "required": [
                            "source"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "source": {
                                "type": "string",
                                "description": "The name for a source that will be used to store and read the localized files"
                            },
                            "locales": {
                                "type": "array",
                                "description": "The list of locales that will be used to perform translations on the item names. Sorted by preference, like: 'en_US', 'es_ES' (see TurboCommons LocalizedFilesManager constructor docs for more info)"
                            },
                            "locations": {
                                "type": "array",
                                "description": "A list (sorted by preference) where each item defines a translations location (see TurboCommons LocalizedFilesManager constructor docs for more info)"
                            },
                            "failIfKeyNotFound": {
                                "type": "boolean",
                                "description": "True to throw an exception if any localization key is not found (see TurboCommons LocalizedFilesManager constructor docs for more info)"
                            }
                        }
                    },
                    "logs": {
                        "type": "object",
                        "description": "Defines the setup for the storage of logs into this depot instance",
                        "required": [
                            "source"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "source": {
                                "type": "string",
                                "description": "The name for a source that will be used to store and read the logs"
                            }
                        }
                    },
                    "objects": {
                        "type": "object",
                        "description": "",
                        "required": [
                            "source"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "source": {
                                "type": "string",
                                "description": ""
                            }
                        }
                    },
                    "googleDrive": {
                        "type": "object",
                        "description": "Defines the setup for the google drive client",
                        "required": [
                            "accountCredentialsPath",
                            "apiClientRoot",
                            "cacheRootPath",
                            "cacheZone",
                            "listsTimeToLive",
                            "filesTimeToLive"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "accountCredentialsPath": {
                                "type": "string",
                                "description": "A full file system path to the file that contains the service account credentials that will be used to authenticate with the google drive API"
                            },
                            "apiClientRoot": {
                                "type": "string",
                                "description": "A full file system path to the root of the google-api-php-client library. See GoogleDriveManager class for more info"
                            },
                            "cacheRootPath": {
                                "type": "string",
                                "description": "A full file system path to the root of the folder where the cached google drive files will be stored. Set it to empty string to disable local cache. See GoogleDriveManager class for more info"
                            },
                            "cacheZone": {
                                "type": "string",
                                "description": "The name for the cache zone where the google drive cached files will be stored. See GoogleDriveManager class for more info"
                            },
                            "listsTimeToLive": {
                                "type": "integer",
                                "description": "Defines the number of seconds after which the operations related to listing files and folder cache data will be deleted. Set it to 0 to for an infinite time. (1 hour = 3600 seconds, 1 day = 86400 seconds, 1 month = 2592000, 1 year = 31536000)"
                            },
                            "filesTimeToLive": {
                                "type": "integer",
                                "description": "Defines the number of seconds after which the operations related to getting files content cache data will be deleted. Set it to 0 to for an infinite time. (1 hour = 3600 seconds, 1 day = 86400 seconds, 1 month = 2592000, 1 year = 31536000)"
                            }
                        }
                    },
                    "users": {
                        "type": "object",
                        "description": "Defines the setup for the storage of users into this depot instance",
                        "required": [
                            "source",
                            "prefix",
                            "tokenLifeTime",
                            "isTokenLifeTimeRecycled"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "source": {
                                "type": "string",
                                "description": "The name for a source that will be used to store and read the users"
                            },
                            "prefix": {
                                "type": "string",
                                "description": "The prefix to use with database table names for all the user related database tables. This will help with avoiding table name collisions on a database"
                            },
                            "tokenLifeTime": {
                                "type": "integer",
                                "description": "Defines the number of seconds that user tokens will be active since they are created. After the number of seconds has passed, tokens will expire and a login will be necessary to obtain a new token"
                            },
                            "isTokenLifeTimeRecycled": {
                                "type": "boolean",
                                "description": "If set to true, every time a token is validated the lifetime will be restarted to the configured token lifetime. So the token lifetime will start counting again after the last token validation has been performed. So with a 10 minutes token lifetime if we perform 2 token validations in 5 minutes, the time will still be 10 minutes after the last validation's been performed."
                            }
                        }
                    }
                }
            }
        },
        "sources": {
            "type": "object",
            "description": "Defines the destinations where the data will be saved and read",
            "required": [],
            "additionalProperties": false,
            "properties": {
                "fileSystem": {
                    "type": "array",
                    "description": "Defines a source that stores all data using OS files and folders",
                    "items": {
                        "type": "object",
                        "description": "",
                        "required": [
                            "name",
                            "path"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "A name we want to use as an alias for this file system source"
                            },
                            "path": {
                                "type": "string",
                                "description": "An absolute path that points to the root of this file system source. This is where the data will be stored when we use this source alias on our depots"
                            }
                        }
                    }
                },
                "mariadb": {
                    "type": "array",
                    "description": "Defines a source that stores all data using a MariaDb or Mysql (legacy) database storage engine",
                    "items": {
                        "type": "object",
                        "description": "",
                        "required": [
                            "name",
                            "host",
                            "database",
                            "user",
                            "password"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "A name we want to use as an alias for this database source"
                            },
                            "host": {
                                "type": "string",
                                "description": "The host where database is found. Usually localhost if the db is on the same machine, but may be any ip or hostname where db may be found"
                            },
                            "database": {
                                "type": "string",
                                "description": "The name for the database to which this source will be connected"
                            },
                            "user": {
                                "type": "string",
                                "description": "The user name that will be used to connect to this source's database"
                            },
                            "password": {
                                "type": "string",
                                "description": "The password to use with the user when connecting to database"
                            }
                        }
                    }
                },
                "sqLite": {
                    "type": "array",
                    "description": "Defines a source that stores all data using an SQLite database storage engine",
                    "items": {
                        "type": "object",
                        "description": "",
                        "required": [
                            "name",
                            "path",
                            "prefix"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": ""
                            },
                            "path": {
                                "type": "string",
                                "description": ""
                            },
                            "prefix": {
                                "type": "string",
                                "description": ""
                            }
                        }
                    }
                }
            }
        }
    }
}