{
    "$schema": "http://json-schema.org/draft-07/schema",
    "title": "Discord Webhook",
    "description": "Discord Webhook JSON Schema",
    "definitions": {
        "string": {
            "type": "string",
            "default": ""
        },
        "boolean": {
            "type": "boolean",
            "default": false
        },
        "url": {
            "$ref": "#/definitions/string",
            "pattern": "^https?://"
        },
        "id": {
            "$ref": "#/definitions/string",
            "pattern": "^\\d+$"
        }
    },
    "type": "object",
    "additionalProperties": false,
    "anyOf": [
        {
            "required": [
                "content"
            ]
        },
        {
            "required": [
                "embeds"
            ]
        }
    ],
    "properties": {
        "$schema": {
            "description": "Allow $schema because additionalProperties is false",
            "$ref": "#/definitions/string"
        },
        "content": {
            "description": "The message contents\nMax is 2000 characters",
            "$ref": "#/definitions/string",
            "maxLength": 2000
        },
        "username": {
            "description": "Override the default username of the webhook\nName cannot contain \"clyde\"",
            "$ref": "#/definitions/string",
            "pattern": "^((?!(c|C)(l|L)(y|Y)(d|D)(e|E)).)*$",
            "maxLength": 80
        },
        "avatar_url": {
            "description": "Override the default avatar of the webhook",
            "$ref": "#/definitions/url"
        },
        "tts": {
            "description": "Whether or not this message will play in TTS\nDefault is false",
            "$ref": "#/definitions/boolean"
        },
        "embeds": {
            "description": "Embedded rich content\nMax is 6000 characters",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "title": {
                        "description": "Title of embed\nMax is 256 characters",
                        "$ref": "#/definitions/string",
                        "maxLength": 256
                    },
                    "description": {
                        "description": "Description of embed\nMax is 4096 characters",
                        "$ref": "#/definitions/string",
                        "maxLength": 4096
                    },
                    "url": {
                        "description": "URL of embed\nOnly support http / https",
                        "$ref": "#/definitions/url"
                    },
                    "timestamp": {
                        "description": "Timestamp of embed content\nISO8601 Timestamp",
                        "$ref": "#/definitions/string",
                        "format": "date-time"
                    },
                    "color": {
                        "description": "Color code of the embed\nOnly support color in decimal\nTo match embed background color, use 3092790\nDefault is 2105893",
                        "type": "integer",
                        "default": 2105893,
                        "minimum": 0,
                        "maximum": 16777215
                    },
                    "footer": {
                        "description": "Footer information",
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "text"
                        ],
                        "properties": {
                            "text": {
                                "description": "Footer text\nMax is 2048 characters",
                                "type": "string",
                                "default": "",
                                "maxLength": 2048
                            },
                            "icon_url": {
                                "description": "URL of footer icon\nOnly support http / https",
                                "$ref": "#/definitions/url"
                            }
                        }
                    },
                    "image": {
                        "description": "Image information",
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "url"
                        ],
                        "properties": {
                            "url": {
                                "description": "Source url of image\nOnly support http / https",
                                "$ref": "#/definitions/url"
                            }
                        }
                    },
                    "thumbnail": {
                        "description": "Thumbnail information",
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "url"
                        ],
                        "properties": {
                            "url": {
                                "description": "Source url of thumbnail\nOnly support http / https",
                                "$ref": "#/definitions/url"
                            }
                        }
                    },
                    "author": {
                        "description": "Author information",
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "name"
                        ],
                        "properties": {
                            "name": {
                                "description": "Name of author\nMax is 256 characters",
                                "$ref": "#/definitions/string",
                                "maxLength": 256
                            },
                            "url": {
                                "description": "URL of author\nOnly support http / https",
                                "$ref": "#/definitions/url"
                            },
                            "icon_url": {
                                "description": "URL of author icon\nOnly support http / https",
                                "$ref": "#/definitions/url"
                            }
                        }
                    },
                    "fields": {
                        "description": "Fields information",
                        "type": "array",
                        "items": {
                            "description": "Fields information",
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "name",
                                "value"
                            ],
                            "properties": {
                                "name": {
                                    "description": "Name of the field\nREQUIRED Max is 256",
                                    "$ref": "#/definitions/string",
                                    "minLength": 1,
                                    "maxLength": 256
                                },
                                "value": {
                                    "description": "Value of the field\nREQUIRED Max is 1024",
                                    "$ref": "#/definitions/string",
                                    "minLength": 1,
                                    "maxLength": 1024
                                },
                                "inline": {
                                    "description": "Whether or not this field should display inline\nDefault is false",
                                    "$ref": "#/definitions/boolean"
                                }
                            }
                        }
                    }
                }
            }
        },
        "allowed_mentions": {
            "description": "Allowed mentions for the message",
            "type": "object",
            "minProperties": 1,
            "additionalProperties": false,
            "properties": {
                "parse": {
                    "description": "An array of allowed mention types to parse from the content.",
                    "type": "array",
                    "default": [],
                    "items": {
                        "type": "string",
                        "enum": [
                            "roles",
                            "users",
                            "everyone"
                        ]
                    }
                },
                "roles": {
                    "description": "Array of role_ids to mention\nMax is 100 of role_ids\nMutually exclusive with parse roles",
                    "type": [
                        "array",
                        "null"
                    ],
                    "default": [],
                    "uniqueItems": true,
                    "maxItems": 100,
                    "items": {
                        "$ref": "#/definitions/id"
                    }
                },
                "users": {
                    "description": "Array of user_ids to mention\nMax is 100 of user_ids\nMutually exclusive with parse users",
                    "type": [
                        "array",
                        "null"
                    ],
                    "default": [],
                    "uniqueItems": true,
                    "maxItems": 100,
                    "items": {
                        "$ref": "#/definitions/id"
                    }
                }
            }
        }
    }
}