{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "redmine": {
            "$ref": "#/definitions/redmine-configuration"
        },
        "git-lab": {
            "$ref": "#/definitions/git-lab-configuration"
        }
    },
    "required": [
        "redmine",
        "git-lab"
    ],
    "definitions": {
        "redmine-configuration": {
            "properties": {
                "username": {
                    "type": "string",
                    "description": "Your Redmine username (must be an administrator)."
                },
                "password": {
                    "type": "string",
                    "description": "Your Redmine password."
                },
                "base-uri": {
                    "type": "string",
                    "description": "The base URL of your Redmine installation."
                }
            },
            "required": [
                "username",
                "password",
                "base-uri"
            ],
            "additionalProperties": false
        },
        "git-lab-configuration": {
            "properties": {
                "private-token": {
                    "type": "string",
                    "description": "Your GitLab private token (can be found in your account settings)."
                },
                "base-uri": {
                    "type": "string",
                    "description": "The base URL of your GitLab installation (incl. API prefix)."
                },
                "labels-mapping": {
                    "$ref": "#/definitions/labels-mapping",
                    "description": "Describes how to map Redmine ticket meta data to GitLab issue labels."
                },
                "users-mapping": {
                    "$ref": "#/definitions/users-mapping",
                    "description": "Describes how to map an assignee's Redmine user ID to his GitLab user ID."
                }
            },
            "required": [
                "private-token",
                "base-uri"
            ],
            "additionalProperties": false
        },
        "labels-mapping": {
            "properties": {
                "tracker": {
                    "$ref": "#/definitions/simple-label-mapping",
                    "description": "Labels to assign to tickets of a specific tracker."
                },
                "status": {
                    "$ref": "#/definitions/simple-label-mapping",
                    "description": "Labels to assign to tickets with a specific status."
                },
                "priority": {
                    "$ref": "#/definitions/simple-label-mapping",
                    "description": "Labels to assign to tickets with a specific priority."
                },
                "custom-field": {
                    "patternProperties": {
                        ".*": {
                            "$ref": "#/definitions/simple-label-mapping"
                        }
                    },
                    "description": "Labels to assign to tickets with one or more specific custom field value(s)."
                }
            },
            "additionalProperties": false
        },
        "simple-label-mapping": {
            "type": "object",
            "patternProperties": {
                ".*": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "string"
                    }
                }
            },
            "additionalProperties": false
        },
        "users-mapping": {
            "type": "object",
            "patternProperties": {
                "^\\d+$": {
                    "type": "integer",
                    "minimum": 1
                }
            },
            "additionalProperties": false
        }
    }
}