{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://paperhive.org/api/v0/schemas/annotation_post.json#",
    "description": "PaperHive annotation schema for POSTing",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "$schema": {
            "enum": [
                "http://paperhive.org/api/v0/schemas/annotation_post.json#"
            ]
        },
        "publication_id": {
            "type": "string"
        },
        "target": {
            "oneOf": [
                {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "type": {
                            "enum": [
                                "FragmentSelector"
                            ]
                        },
                        "page": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "x": {
                            "type": "number"
                        },
                        "y": {
                            "type": "number"
                        },
                        "w": {
                            "type": "number"
                        },
                        "h": {
                            "type": "number"
                        }
                    },
                    "required": [
                        "type",
                        "page",
                        "x",
                        "y",
                        "w",
                        "h"
                    ]
                }
            ]
        },
        "body": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "type": {
                    "enum": [
                        "markdown"
                    ]
                },
                "value": {
                    "type": "string"
                },
                "language": {
                    "type": "string"
                }
            },
            "required": [
                "type",
                "value"
            ]
        }
    },
    "required": [
        "publication_id",
        "target",
        "body"
    ]
}