{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Object install-if-different property",
    "description": "This property handles when an object should be installed on target",
    "oneOf": [
        {
            "title": "sha256sum verification type",
            "description": "Installs if sha256sum doesn't match",
            "type": "string",
            "enum": [
                "sha256sum"
            ]
        },
        {
            "title": "Known patterns verification type",
            "description": "Installs if version of know object type is different",
            "type": "object",
            "properties": {
                "version": {
                    "type": "string"
                },
                "pattern": {
                    "type": "string",
                    "enum": [
                        "linux-kernel",
                        "u-boot"
                    ]
                }
            },
            "required": [
                "version",
                "pattern"
            ],
            "additionalProperties": false
        },
        {
            "title": "Custom pattern verification type",
            "description": "Installs if version of unknow object type is different",
            "type": "object",
            "properties": {
                "version": {
                    "type": "string"
                },
                "pattern": {
                    "type": "object",
                    "properties": {
                        "regexp": {
                            "description": "the pattern to match",
                            "type": "string"
                        },
                        "seek": {
                            "description": "Where to start reading file.",
                            "type": "integer",
                            "default": 0
                        },
                        "buffer-size": {
                            "description": "How much bytes must be read. If -1, until the end.",
                            "type": "integer",
                            "default": -1
                        }
                    },
                    "additionalProperties": false,
                    "required": [
                        "regexp"
                    ]
                }
            },
            "additionalProperties": false,
            "required": [
                "version",
                "pattern"
            ]
        }
    ]
}