{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/BlockMeta",
  "title": "BlockMeta",
  "type": "object",
  "description": "Metadata for a single TSDB block managed by the Compactor.",
  "required": [
    "ulid",
    "minTime",
    "maxTime"
  ],
  "properties": {
    "ulid": {
      "type": "string",
      "description": "Unique identifier for the block.",
      "example": "01FHND2RNJHSZ7E7XFPVKH2JG"
    },
    "minTime": {
      "type": "integer",
      "format": "int64",
      "description": "Minimum timestamp in milliseconds for data in this block."
    },
    "maxTime": {
      "type": "integer",
      "format": "int64",
      "description": "Maximum timestamp in milliseconds for data in this block."
    },
    "compaction": {
      "type": "object",
      "description": "Compaction metadata tracking the block's compaction history.",
      "properties": {
        "level": {
          "type": "integer",
          "description": "Compaction level. Raw blocks start at level 1; each compaction pass increments the level."
        },
        "sources": {
          "type": "array",
          "description": "ULIDs of source blocks merged to create this block.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "thanos": {
      "type": "object",
      "description": "Thanos-specific extensions to block metadata.",
      "properties": {
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "External labels identifying the origin of this block."
        },
        "downsample": {
          "type": "object",
          "description": "Downsampling resolution information.",
          "properties": {
            "resolution": {
              "type": "integer",
              "format": "int64",
              "description": "Resolution in milliseconds. 0 for raw, 300000 for 5-minute, 3600000 for 1-hour downsampled data."
            }
          }
        },
        "source": {
          "type": "string",
          "description": "Thanos component that produced this block.",
          "enum": [
            "sidecar",
            "receive",
            "ruler",
            "compactor",
            "unknown"
          ]
        }
      }
    }
  }
}