{
    "$schema": "http://json-schema.org/schema#",
    "type": "object",
    "properties": {
        "type": {
            "type": "string",
            "description": "The service type (should always be 'aurora-serverless')",
            "pattern": "aurora-serverless",
            "errorMessage": "Must equal 'aurora-serverless'"
        },
        "engine": {
            "type": "string",
            "pattern": "^mysql$",
            "errorMessage": "Must be one of the following values: mysql"
        },
        "version": {
            "type": "string",
            "errorMessage": "Must be a string"
        },
        "database_name": {
            "type": "string",
            "errorMessage": "Must be a string"
        },
        "description": {
            "type": "string",
            "errorMessage": "Must be a string"
        },
        "scaling": {
            "$ref": "#/definitions/scaling"
        },
        "cluster_parameters": {
            "$ref": "#/definitions/db_parameters"
        },
        "tags": {
            "type": "object",
            "description": "An arbitrary list of key/value pairs to be added as tags to the service",
            "patternProperties": {
                "^.*$": {
                    "anyOf": [
                        {"type": "string"},
                        {"type": "number"}
                    ]
                }
            },
            "errorMessage": "Must contain 1 or more simple key/value pairs where the values are strings or numbers",
            "additionalProperties": false
        }
    },
    "required": ["type", "engine", "version", "database_name"],
    "additionalProperties": false,
    "errorMessage": {
        "additionalProperties": "Invalid/unknown property specified",
        "required": {
            "type": "The 'type' field is required",
            "engine": "The 'engine' field is required",
            "version": "The 'version' field is required",
            "database_name": "The 'database_name' field is required"
        }
    },
    "definitions": {
        "db_parameters": {
            "type": "object",
            "description": "A list of key/value RDS database parameters",
            "patternProperties": {
                "^.*$": {
                    "anyOf": [
                        {"type": "string"},
                        {"type": "number"}
                    ]
                }
            },
            "errorMessage": "Must contain 1 or more simple key/value pairs where the values are strings or numbers",
            "additionalProperties": false
        },
        "scaling": {
            "type": "object",
            "description": "Database scaling configuration",
            "properties": {
                "auto_pause": {
                    "type": "boolean",
                    "description": "Whether to automatically pause the database",
                    "errorMessage": "Must be a boolean"
                },
                "seconds_until_auto_pause": {
                    "type": "number",
                    "description": "How long the database must be idle before it can be paused",
                    "errorMessage": "Must be a number"
                },
                "min_capacity": {
                    "$ref": "#/definitions/db_capacity",
                    "description": "The minimum capacity (in Aurora Compute Units)"
                },
                "max_capacity": {
                    "$ref": "#/definitions/db_capacity",
                    "description": "The maximum capacity (in Aurora Compute Units)"
                }
            }
        },
        "db_capacity": {
            "type": "number",
            "enum": [2, 4, 8, 16, 32, 64, 128, 256]
        }
    }
}