{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://morpheusradar.com/dados/v1/schema/index.schema.json",
  "title": "Morpheus Radar open data v1 · index.json and latest.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema_version",
    "generated_at",
    "min_delay_seconds",
    "license",
    "index",
    "latest",
    "sha256sums",
    "readme",
    "schemas",
    "datasets",
    "daily"
  ],
  "properties": {
    "$schema": {
      "const": "https://morpheusradar.com/dados/v1/schema/index.schema.json"
    },
    "schema_version": {
      "type": "string",
      "pattern": "^1\\.[0-9]+$"
    },
    "generated_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "min_delay_seconds": {
      "type": "integer",
      "minimum": 3600
    },
    "license": {
      "const": {
        "id": "CC-BY-4.0",
        "url": "https://creativecommons.org/licenses/by/4.0/",
        "attribution": "Source: Morpheus Radar (morpheusradar.com)"
      }
    },
    "index": {
      "const": "/dados/v1/index.json"
    },
    "latest": {
      "const": "/dados/v1/latest.json"
    },
    "sha256sums": {
      "const": "/dados/v1/SHA256SUMS"
    },
    "readme": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "bytes",
        "sha256"
      ],
      "properties": {
        "url": {
          "const": "/dados/v1/README.txt"
        },
        "bytes": {
          "type": "integer",
          "minimum": 1
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "schemas": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "bytes",
          "sha256"
        ],
        "properties": {
          "url": {
            "type": "string",
            "pattern": "^/dados/v1/schema/[a-z0-9-]+\\.schema\\.json$"
          },
          "bytes": {
            "type": "integer",
            "minimum": 1
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      }
    },
    "datasets": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "window_start",
          "window_end",
          "generated_at",
          "complete",
          "files"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "example",
              "rolling",
              "daily"
            ]
          },
          "study": {
            "type": "string"
          },
          "readme": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "window_end": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "generated_at": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "complete": {
            "type": "boolean"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "content",
                "format",
                "url",
                "schema",
                "bytes",
                "rows",
                "sha256"
              ],
              "properties": {
                "content": {
                  "enum": [
                    "transactions",
                    "liquidations",
                    "markets"
                  ]
                },
                "format": {
                  "enum": [
                    "json",
                    "csv"
                  ]
                },
                "url": {
                  "type": "string",
                  "pattern": "^/dados/v1/.+\\.(json|csv)$"
                },
                "schema": {
                  "type": "string",
                  "pattern": "^/dados/v1/schema/[a-z0-9-]+\\.schema\\.json$"
                },
                "bytes": {
                  "type": "integer",
                  "minimum": 1
                },
                "rows": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              }
            }
          },
          "latest": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "json",
              "csv"
            ],
            "properties": {
              "json": {
                "type": "string"
              },
              "csv": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "daily": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "window_start",
          "window_end",
          "generated_at",
          "complete",
          "files"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "example",
              "rolling",
              "daily"
            ]
          },
          "study": {
            "type": "string"
          },
          "readme": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "window_end": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "generated_at": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "complete": {
            "type": "boolean"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "content",
                "format",
                "url",
                "schema",
                "bytes",
                "rows",
                "sha256"
              ],
              "properties": {
                "content": {
                  "enum": [
                    "transactions",
                    "liquidations",
                    "markets"
                  ]
                },
                "format": {
                  "enum": [
                    "json",
                    "csv"
                  ]
                },
                "url": {
                  "type": "string",
                  "pattern": "^/dados/v1/.+\\.(json|csv)$"
                },
                "schema": {
                  "type": "string",
                  "pattern": "^/dados/v1/schema/[a-z0-9-]+\\.schema\\.json$"
                },
                "bytes": {
                  "type": "integer",
                  "minimum": 1
                },
                "rows": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              }
            }
          },
          "latest": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "json",
              "csv"
            ],
            "properties": {
              "json": {
                "type": "string"
              },
              "csv": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
