{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trackbtc.bot/schemas/archive-v1.json",
  "title": "TrackBTC published alert archive indexes",
  "description": "Cumulative indexes grouped by alert observation-period month, not publication month. Each row links to the current public JSON representation.",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "contract": {
          "const": "trackbtc_public_archive_v1"
        },
        "months": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "month": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}$"
              },
              "url": {
                "type": "string"
              },
              "json_url": {
                "type": "string"
              },
              "count": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "month",
              "url",
              "json_url",
              "count"
            ],
            "additionalProperties": false
          },
          "maxItems": 1200
        },
        "$schema": {
          "const": "https://trackbtc.bot/schemas/archive-v1.json"
        }
      },
      "required": [
        "contract",
        "months",
        "$schema"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "contract": {
          "const": "trackbtc_public_archive_month_v1"
        },
        "month": {
          "type": "string"
        },
        "alerts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^tb-[0-9A-Za-z]+-[dw][0-9A-Za-z]+$"
              },
              "type": {
                "enum": [
                  "daily",
                  "weekly"
                ]
              },
              "headline": {
                "type": "string"
              },
              "period": {
                "type": "string"
              },
              "available_at": {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              "source_url": {
                "type": "string"
              },
              "json_url": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "type",
              "headline",
              "period",
              "available_at",
              "source_url",
              "json_url"
            ],
            "additionalProperties": false
          },
          "maxItems": 10000
        },
        "$schema": {
          "const": "https://trackbtc.bot/schemas/archive-v1.json"
        }
      },
      "required": [
        "contract",
        "month",
        "alerts",
        "$schema"
      ],
      "additionalProperties": false
    }
  ]
}
