{
    "$schema": "http://json-schema.org/schema#",
    "$id": "Stream",
    "definitions": {
        "file": {
            "type": "object",
            "description": "A stream coming from a file",
            "properties": {
                "description": {
                    "type": "string",
                    "description": "A user friendly description of the stream"
                },
                "ftype": {
                    "type": "string"
                },
                "example": {
                    "type": "string",
                    "description": "A example of the stream. Could be a png file, text example, etc."
                },
                "location": {
                    "description": "System path to the file",
                    "type": "string"
                }
            }
        },
        "url": {
            "type": "object",
            "description": "A URL pointing to some external resource",
            "properties": {
                "description": {
                    "type": "string",
                    "description": "A user friendly description of the resource"
                },
                "protocol": {
                    "type": "array",
                    "description": "The protocol used to connect to the resource",
                    "$comment": "Probably just using a enum will not be enough. Some protocols could require extra stuff (like certificates, tokens, etc.)",
                    "items": {
                        "type": "string",
                        "enum": [
                            "ftp",
                            "http",
                            "https",
                            "ftps",
                            "rstp"
                        ]
                    }
                },
                "example": {
                    "type": "string"
                },
                "location": {
                    "type": "string",
                    "description": "The endpoint itself"
                }
            }
        }
    },
    "type": "object",
    "properties": {
        "name": {
            "description": "Name of the stream that acts as identifier",
            "type": "string",
            "$comment": "Must have some regex"
        },
        "feature": {
            "description": "A similar stream could have different features. Describing the features of the stream assures the correct results when processing it",
            "type": "object"
        },
        "format": {
            "oneOf": [
                {
                    "$ref": "#/definitions/file"
                },
                {
                    "$ref": "#/definitions/url"
                }
            ]
        }
    },
    "required": [
        "name",
        "feature",
        "format"
    ]
}