{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "date": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
        },
        "date-or-placeholder": {
            "type": "string",
            "pattern": "^([0-9]{4}-[0-9]{2}-[0-9]{2}|-?)$"
        },
        "hex-color": {
            "type": "string",
            "pattern": "^#[0-9a-f]{6}$"
        },
        "lang": {
            "type": "string",
            "pattern": "^[a-z]{2}(-[a-z]{2})?$"
        }
    },
    "title": "Timeline schema",
    "description": "Defines the timeline input format and thus API",
    "type": "object",
    "properties": {
        "settings": {
            "type": "object",
            "properties": {
                "lang": {
                    "$ref": "#/definitions/lang"
                },
                "zoom": {
                    "type": "number",
                    "minimum": 50,
                    "maximum": 300
                },
                "end": {
                    "$ref": "#/definitions/date-or-placeholder"
                },
                "hideDaysFrom": {
                    "type": "number"
                },
                "hideMonthsFrom": {
                    "type": "number"
                }
            }
        },
        "theme": {
            "type": "object",
            "properties": {
                "colorScheme": {
                    "type": "string",
                    "pattern": "^(gradient|duration)$"
                },
                "borderColor1": {
                    "$ref": "#/definitions/hex-color"
                },
                "fillColor1": {
                    "$ref": "#/definitions/hex-color"
                },
                "borderColor2": {
                    "$ref": "#/definitions/hex-color"
                },
                "fillColor2": {
                    "$ref": "#/definitions/hex-color"
                },
                "frameBorderColor": {
                    "$ref": "#/definitions/hex-color"
                },
                "frameFillColor": {
                    "$ref": "#/definitions/hex-color"
                },
                "stripeColorDark": {
                    "$ref": "#/definitions/hex-color"
                },
                "stripeColorLight": {
                    "$ref": "#/definitions/hex-color"
                },
                "gridColor": {
                    "$ref": "#/definitions/hex-color"
                }
            }
        },
        "tasks": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "start": {
                        "$ref": "#/definitions/date"
                    },
                    "end": {
                        "$ref": "#/definitions/date-or-placeholder"
                    },
                    "recur": {
                        "type": "number",
                        "minimum": 1,
                        "maximum": 365
                    },
                    "startTo": {
                        "type": "array",
                        "items": {
                            "type": "number",
                            "minimum": 1,
                            "maximum": 256
                        },
                        "minItems": 1,
                        "_uniqueItems": true
                    },
                    "endTo": {
                        "type": "array",
                        "items": {
                            "type": "number",
                            "minimum": 1,
                            "maximum": 256
                        },
                        "minItems": 1,
                        "_uniqueItems": true
                    },
                    "milestones": {
                        "type": "array",
                        "items": {
                            "$ref": "#/definitions/date"
                        },
                        "minItems": 1,
                        "_uniqueItems": true
                    },
                    "stamps": {
                        "type": "array",
                        "items": {
                            "$ref": "#/definitions/date"
                        },
                        "minItems": 1,
                        "_uniqueItems": true
                    }
                },
                "required": [
                    "start",
                    "end"
                ]
            },
            "minItems": 1,
            "_uniqueItems": true
        }
    },
    "required": [
        "tasks"
    ]
}