{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.ectropy.ai/flow/intake/bag-pointer.schema.json",
  "title": "Robot Recording Pointer",
  "version": "0.3.0",
  "description": "One record per rosbag2 recording: the ledger holds a pointer to the bag, never one event per message. Field names follow rosbag2 BagMetadata (storage_identifier, starting_time, duration, message_count) and MCAP; MCAP timestamps are nanoseconds since a declared epoch; here startingTime and duration carry them as ROS 2 builtin_interfaces Time and Duration ({sec, nanosec}, without the int32 seconds bound), so every integer stays within the I-JSON safe range (RFC 7493 section 2.2) and the record is RFC 8785-canonicalizable.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "bagUri",
    "sha256",
    "storageIdentifier",
    "epoch",
    "startingTime",
    "duration",
    "messageCount",
    "projectRef",
    "sourceId"
  ],
  "properties": {
    "bagUri": {
      "type": "string",
      "format": "uri"
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "storageIdentifier": {
      "enum": [
        "mcap",
        "sqlite3"
      ]
    },
    "rosDistro": {
      "type": "string"
    },
    "epoch": {
      "const": "unix-utc"
    },
    "startingTime": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sec",
        "nanosec"
      ],
      "properties": {
        "sec": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "nanosec": {
          "type": "integer",
          "minimum": 0,
          "maximum": 999999999
        }
      }
    },
    "duration": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sec",
        "nanosec"
      ],
      "properties": {
        "sec": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "nanosec": {
          "type": "integer",
          "minimum": 0,
          "maximum": 999999999
        }
      }
    },
    "messageCount": {
      "type": "integer",
      "minimum": 0
    },
    "topics": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "type",
          "messageCount"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^/"
          },
          "type": {
            "type": "string"
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "projectRef": {
      "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/projectUri"
    },
    "sourceId": {
      "type": "string",
      "minLength": 1
    }
  }
}
