{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/mailer.json",
    "type": "object",
    "title": "Mailer configuration",
    "additionalProperties": false,
    "required": [
        "enabled",
        "host",
        "port",
        "username",
        "password",
        "secure",
        "from",
        "timeout",
        "context",
        "clientHost",
        "persistent",
        "theme"
    ],
    "properties": {
        "enabled": {
            "type": "boolean",
            "title": "Mailer enablement",
            "example": false
        },
        "host": {
            "type": "string",
            "title": "SMTP host",
            "example": "localhost",
            "anyOf": [
                {
                    "format": "hostname"
                },
                {
                    "format": "ipv4"
                },
                {
                    "format": "ipv6"
                }
            ]
        },
        "port": {
            "type": "integer",
            "title": "SMTP port",
            "example": 465,
            "minimum": 1,
            "maximum": 65535
        },
        "username": {
            "type": "string",
            "title": "SMTP username",
            "example": "root"
        },
        "password": {
            "type": "string",
            "title": "SMTP password",
            "example": ""
        },
        "secure": {
            "type": [
                "string",
                "null"
            ],
            "enum": [
                "ssl",
                "tls",
                null
            ],
            "title": "SMTP connection security",
            "description": "null - None, ssl - TLS, tls - STARTTLS",
            "example": "tls"
        },
        "from": {
            "type": "string",
            "format": "email",
            "title": "Sender",
            "example": "iqrf-gw@localhost.localdomain"
        },
        "theme": {
            "type": "string",
            "title": "Mail theme",
            "example": "generic"
        },
        "timeout": {
            "type": "integer",
            "title": "SMTP connection timeout (default 20 s)",
            "minimum": 1,
            "example": 20
        },
        "context": {
            "title": "Context for connecting to the SMTP server",
            "description": "Stream context options, see https://www.php.net/manual/en/context.php",
            "anyOf": [
                {
                    "type": "object",
                    "additionalProperties": {
                        "type": "object"
                    }
                },
                {
                    "type": "array",
                    "maxItems": 0
                },
                {
                    "type": "null"
                }
            ],
            "example": {
                "ssl": {
                    "verify_peer": false
                }
            }
        },
        "clientHost": {
            "title": "SMTP client hostname",
            "description": "null or empty string = gateway hostname",
            "anyOf": [
                {
                    "type": "string",
                    "format": "hostname"
                },
                {
                    "type": "string",
                    "maxLength": 0
                },
                {
                    "type": "null"
                }
            ],
            "example": "iqrf-gw.localhost.localdomain"
        },
        "persistent": {
            "type": "boolean",
            "title": "Persistent connection to SMTP server",
            "example": false
        }
    }
}
