{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/TinkerStorm/channel-backup/raw/main/schemas/config.json",
  "title": "Discord Message Structure",
  "description": "A Discord message.",
  "type": "object",
  "anyOf": [
    {"required": ["content"]},
    {"required": ["embeds"]}
  ],
  "properties": {
    "content": {
      "type": "string",
      "description": "The content of the message.",
      "maxLength": 2000
    },
    "embeds": {
      "type": "array",
      "description": "Embeds in the message.",
      "items": {
        "$ref": "#/definitions/embed"
      }
    },
    "components": {
      "type": "array",
      "description": "Components in the message.",
      "items": {
        "$ref": "#/definitions/component-row"
      }
    },
    "tts": {
      "type": "boolean",
      "description": "Whether the message is a TTS message."
    },
    "avatarURL": {
      "type": "string",
      "description": "The avatar URL of the message author."
    },
    "username": {
      "type": "string",
      "description": "The username of the message author."
    }
  },
  "$defs": {
    "component": {
      "type": "object",
      "description": "A Discord component.",
      "properties": {
        "type": {
          "type": "number",
          "description": "The type of the component.",
          "enum": [2, 3]
        },
        "style": {
          "type": "number",
          "description": "The style of the component.",
          "enum": [1, 2, 3, 4, 5]
        },
        "label": {
          "type": "string",
          "description": "The label of the component.",
          "maxLength": 80
        },
        "emoji": {
          "$ref": "#/definitions/emoji",
          "description": "The emoji of the component."
        },
        "custom_id": {
          "type": "string",
          "description": "The custom ID of the component.",
          "maxLength": 100
        },
        "url": {
          "type": "string",
          "description": "The URL of the component.",
          "format": "uri"
        },
        "disabled": {
          "type": "boolean",
          "description": "Whether the component is disabled."
        },
        "options": {
          "type": "array",
          "description": "The options of the component.",
          "items": {
            "$ref": "#/definitions/select-option"
          }
        },
        "placeholder": {
          "type": "string",
          "description": "The placeholder of the component.",
          "maxLength": 100
        },
        "min_values": {
          "type": "integer",
          "description": "The minimum number of values the component can have.",
          "minimum": 1,
          "maximum": 25
        },
        "max_values": {
          "type": "integer",
          "description": "The maximum number of values the component can have.",
          "minimum": 1,
          "maximum": 25
        }
      },
      "required": ["type"],
      "oneOf": [
        {
          "required": ["style", "label", "custom_id"]
        },
        {
          "required": ["style", "label", "url"]
        },
        {
          "required": ["custom_id"]
        },
        {
          "required": ["options", "custom_id"]
        }
      ]
    },
    "component-row": {
      "type": "object",
      "description": "A row of components.",
      "properties": {
        "type": {
          "type": "number",
          "description": "The type of the component.",
          "enum": [1]
        },
        "components": {
          "type": "array",
          "description": "The components in the row.",
          "items": {
            "$ref": "#/definitions/component"
          }
        }
      }
    },
    "embed": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title of the embed."
        },
        "description": {
          "type": "string",
          "description": "The description of the embed."
        },
        "url": {
          "type": "string",
          "description": "The URL of the embed."
        },
        "timestamp": {
          "type": "number",
          "description": "The timestamp of the embed."
        },
        "color": {
          "type": "number",
          "description": "The color of the embed."
        },
        "footer": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string",
              "description": "The text of the footer."
            },
            "iconURL": {
              "type": "string",
              "description": "The icon URL of the footer."
            }
          }
        },
        "image": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL of the image."
            }
          }
        },
        "thumbnail": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL of the thumbnail."
            }
          }
        },
        "fields": {
          "type": "array",
          "description": "The fields of the embed.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the field."
              },
              "value": {
                "type": "string",
                "description": "The value of the field."
              },
              "inline": {
                "type": "boolean",
                "description": "Whether the field is inline."
              }
            },
            "required": [
              "name",
              "value"
            ]
          }
        }
      }
    }
  }
}