{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "description": "Response Status Schema",
    "oneOf": [
        { "$ref": "#/definitions/CODE_MESSAGE" },
        { "$ref": "#/definitions/INVALID_PARAMETERS" }
    ],

    "definitions": {
        "CODE_MESSAGE": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
                "code": {
                    "type": "string",
                    "enum": [
                        "OK",
                        "NotFound",
                        "NotImplemented",
                        "UnAuthorized",
                        "UnAuthenticated",
                        "Unknown"
                    ],
                    "default": "NotImplemented"
                },
                "message": { "type": "string" }
            },
            "additionalProperties": false
        },

        "INVALID_PARAMETERS": {
            "type": "object",
            "required": ["code", "message", "parameters"],
            "properties": {
                "code": { "const": "InvalidParameters", "type": "string" },
                "message": { "type": "string" },
                "parameters": {
                    "type": "object",
                    "minProperties": 1,
                    "additionalProperties": {
                        "oneOf": [
                            { "type": "string" },
                            { "type": "array", "minItems": 1, "items": { "type": "string" } }
                        ]
                    },
                    "examples": [
                        {
                            "email": "invalid format, must be something like this Ahmad@Basim.com",
                            "password": [
                                "minimum length is 6",
                                "must contain capital letters",
                                "must contain small letters",
                                "must contain numbers",
                                "must contain symbols like (!@#$*_) or spaces"
                            ]
                        },
                        {
                            "username": "must not contain spaces"
                        }
                    ]
                }
            },
            "additionalProperties": false
        }
    }
}