{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "description": "http-submission schema",
    "additionalProperties": false,
    "required": ["serverid", "port"],
    "properties": {
        "serverid": {
            "type": "string",
            "description": "The server ID"
        },
        "transportid": {
            "type": "string",
            "description": "The transport ID"
        },
        "port": {
            "type": "integer",
            "description": "The port to listen on"
        },
        "address": {
            "type": "string",
            "description": "The address to listen on"
        },
        "pki": {
            "type": "object",
            "description": "The X.509 certificate and private key",
            "additionalProperties": false,
            "required": [
                "certificate",
                "privatekey"
            ],
            "properties": {
                "certificate": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "The PKCS #8 PEM data"
                                }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "path"
                            ],
                            "properties": {
                                "path": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "The PKCS #8 PEM path"
                                }
                            }
                        }
                    ]
                },
                "privatekey": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "The private key data"
                                }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "path"
                            ],
                            "properties": {
                                "path": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "The private key path"
                                }
                            }
                        }
                    ]
                }
            }
        },
        "apikeys": {
            "type": "array",
            "description": "List of allowed API keys for the HTTP server (sent in the \"X-API-Key\" header).",
            "items": {
                "type": "string",
                "minLength": 1
            }
        },
        "source": {
            "type": "boolean",
            "default": false,
            "description": "Pass source information in the metadata."
        },
        "threads": {
            "type": "integer",
            "description": "The number of worker threads. The default is the same as the number of cores."
        },
        "maxsize": {
            "type": "integer",
            "minimum": 1,
            "default": 10485760,
            "description": "The maximum request body size to accept."
        },
        "tracking": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "url",
                "secret"
            ],
            "description": "The tracking settings",
            "properties": {
                "click": {
                    "type": "boolean",
                    "default": false,
                    "description": "If click tracking should be enabled or not."
                },
                "open": {
                    "type": "boolean",
                    "default": false,
                    "description": "If open tracking should be enabled or not."
                },
                "unsubscribe": {
                    "type": "boolean",
                    "default": false,
                    "description": "If one-click list unsubscribe should be enabled or not."
                },
                "url": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The base url that should be used for the rewritten links and tracking pixels."
                },
                "secret": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "id",
                        "key"
                    ],
                    "properties": {
                        "id": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 254,
                            "description": "The ID of the secret that should be used to generate the hash of the tracking payload."
                        },
                        "key": {
                            "type": "string",
                            "minLength": 1,
                            "description": "The key for the secret that should be used to generate the hash of the tracking payload."
                        }
                    }
                }
            }
        },
        "proxy": {
            "oneOf": [
                {
                    "type": "boolean",
                    "description": "Trust all IP-addresses and subnets as being reverse proxies",
                    "default": false
                },
                {
                    "type": "array",
                    "uniqueItems": true,
                    "minItems": 1,
                    "description": "A list of IP addresses and subnets to trust as being reverse proxies",
                    "items": {
                        "type": "string",
                        "minLength": 1
                    },
                    "default": []
                }
            ]
        }
    }
}