{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/TinkerStorm/channel-backup/raw/main/schemas/config.json",
  "title": "Channel Backup Configuration",
  "description": "Channel Backup Configuration",
  "type": "object",
  "properties": {
    "webhook": {
      "required": true,
      "description": "Webhook URL",
      "anyOf": [
        {
          "type": "string",
          "format": "uri",
          "pattern": "^https?:\/\/discord\\.com\/api(?:\/v10)\/webhooks\/[0-9]+\/[A-Za-z0-9_-]+$"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "token": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          },
          "required": [
            "id",
            "token"
          ],
          "additionalProperties": false
        }
      ]
    },
    "files": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "authors": {
      "description": "A map of author avatars.",
      "type": "object",
      "patternProperties": {
        "^*+$": {
          "type": "string",
          "description": "The avatar to resolve to."
        }
      }
    },
    "threadID": {
      "type": "string",
      "description": "The ID of the thread to post to.",
      "pattern": "^[0-9]{17,21}$"
    },
    "thread_name": {
      "type": "string",
      "description": "The name of the thread to post to.",
      "pattern": "^.{1,100}$"
    }
  },
  "oneOf": [
    {},
    {
      "required": [
        "thread_id"
      ]
    },
    {
      "required": [
        "thread_name"
      ]
    }
  ],
  "required": [
    "files"
  ]
}