{
    "id": "http://oth.de/schemas/documents.json",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "documents",
    "description": "a simple data model that save data for different documents",
    "definitions": {
        "document_type": {
            "type": "object",
            "properties": {
                "gid": {
                    "type": "string",
                    "format": "uuid"
                },
                "text": {
                    "description": "Short text that describes the tag",
                    "type": "string"
                },
                "comment": {
                    "description": "Comment to that tab",
                    "type": "string"
                },
                "active": {
                    "description": "is the entry currently active",
                    "type": "boolean"
                }
            }
        },
        "comment": {
            "type": "object",
            "properties": {
                "text": {
                    "description": "comment text",
                    "type": "string"
                },
                "date": {
                    "description": "date of entry",
                    "type": "string",
                    "format": "datetime"
                },
                "user": {
                    "description": "who did this comment",
                    "type": "string"
                }
            }
        },
        "tag": {
            "type": "object",
            "properties": {
                "gid": {
                    "type": "string",
                    "format": "uuid"
                },
                "text": {
                    "description": "Short text that describes the tag",
                    "type": "string"
                },
                "comment": {
                    "description": "Comment to that tab",
                    "type": "string"
                },
                "color": {
                    "description": "color that marks this tag",
                    "type": "string"
                },
                "created": {
                    "type": "string",
                    "format": "datetime"
                }
            }
        },
        "document": {
            "type": "object",
            "properties": {
                "gid": {
                    "type": "string",
                    "format": "uuid"
                },
                "path": {
                    "description": "where is the document located",
                    "type": "string"
                },
                "preview": {
                    "description": "where is the document preview located",
                    "type": "string"
                },
                "icon": {
                    "description": "icon preview for the document",
                    "type": "string"
                },
                "comments": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/comment"
                    }
                },
                "date": {
                    "type": "string",
                    "format": "date"
                },
                "type": {
                    "$ref": "#/definitions/document_type"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "format": "uuid",
                        "ref": "#/definitions/tag"
                    }
                }
            }
        }
    },
    "type": "object",
    "version": 1,
    "properties": {
        "document_type": {
            "$ref": "#/definitions/document_type"
        },
        "comment": {
            "$ref": "#/definitions/comment"
        },
        "tag": {
            "$ref": "#/definitions/tag"
        },
        "document": {
            "$ref": "#/definitions/document"
        }
    },
    "required": [
        "document_type",
        "comment",
        "tag",
        "document"
    ]
}