{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Git Workflow",
    "description": "a use of branches in git called git workflow",
    "type": "object",
    "required": [
        "workflow_name",
        "branches",
        "scenarios"
    ],
    "properties": {
        "workflow_name": {
            "type": "string"
        },
        "branches": {
            "description": "The list of branches who exist all the time",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "scenarios": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/scenarios"
            }
        }
    },
    "definitions": {
        "scenarios": {
            "type": "object",
            "required": [
                "name",
                "commands"
            ],
            "properties": {
                "name": {
                    "type": "string"
                },
                "commands": {
                    "type": "array",
                    "items": {
                        "anyOf": [
                            {
                                "$ref": "#/definitions/startCommand"
                            },
                            {
                                "$ref": "#/definitions/finishCommand"
                            },
                            {
                                "$ref": "#/definitions/nowCommand"
                            }
                        ]
                    }
                }
            }
        },
        "startCommand": {
            "type": "object",
            "required": [
                "name",
                "branch_start"
            ],
            "properties": {
                "name": {
                    "enum": [
                        "start"
                    ]
                },
                "branch_start": {
                    "type": "string"
                }
            }
        },
        "finishCommand": {
            "type": "object",
            "required": [
                "name",
                "branch_finish"
            ],
            "properties": {
                "name": {
                    "enum": [
                        "finish"
                    ]
                },
                "branch_finish": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "tagOn": {
                    "type": "string"
                }
            }
        },
        "nowCommand": {
            "type": "object",
            "required": [
                "branch_start",
                "branch_finish"
            ],
            "properties": {
                "name": {
                    "enum": [
                        "now"
                    ]
                },
                "branch_start": {
                    "type": "string"
                },
                "branch_finish": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "tagOn": {
                    "type": "string"
                }
            }
        }
    }
}