{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Storage Configuration",
    "description": "Configuration for storage. The storage is used to store the images when save function is called.",
    "type": "object",
    "anyOf": [
        {
            "properties": {
                "type": {
                    "const": "Samba",
                    "description": "The storage is a Samba storage."
                },
                "parameters": {
                    "type": "object",
                    "description": "Parameters for the storage. The parameters are different for each storage type.",
                    "properties": {
                        "ip": {
                            "type": "string",
                            "minLength": 1,
                            "description": "The IP address of the Samba server.",
                            "examples": [
                                "192.168.1.50"
                            ]
                        },
                        "remotePath": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Share name and path on the Samba server, without the leading host part.",
                            "examples": [
                                "images",
                                "share/lumiscan/images"
                            ]
                        },
                        "domain": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Windows/Samba domain or workgroup the user belongs to.",
                            "examples": [
                                "WORKGROUP"
                            ]
                        },
                        "username": {
                            "type": "string",
                            "minLength": 1,
                            "examples": [
                                "lumiscan"
                            ]
                        },
                        "password": {
                            "type": "string",
                            "minLength": 1
                        }
                    },
                    "required": [
                        "ip",
                        "remotePath",
                        "domain",
                        "username",
                        "password"
                    ]
                }
            }
        },
        {
            "properties": {
                "type": {
                    "const": "Null",
                    "description": "The storage is disabled."
                }
            }
        },
        {
            "properties": {
                "type": {
                    "const": "Internal"
                },
                "parameters": {
                    "type": "object",
                    "properties": {
                        "rootPath": {
                            "type": "string",
                            "minLength": 1,
                            "description": "The root path of the internal storage. If relative path is used, it is relative to the application's data directory.",
                            "examples": [
                                "images"
                            ]
                        }
                    }
                }
            }
        },
        {
            "properties": {
                "type": {
                    "const": "External"
                }
            }
        }
    ],
    "required": [
        "type"
    ],
    "examples": [
        {
            "type": "Internal",
            "parameters": {
                "rootPath": "images"
            }
        },
        {
            "type": "Samba",
            "parameters": {
                "ip": "192.168.1.50",
                "remotePath": "images",
                "domain": "WORKGROUP",
                "username": "lumiscan",
                "password": "secret"
            }
        },
        {
            "type": "External"
        },
        {
            "type": "Null"
        }
    ]
}
