{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://rsasaki0109.github.io/lidar_slam_ros2/schemas/preflight-v6.schema.json",
  "title": "lidarslam_ros2 preflight v6",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "schema_uri",
    "summary",
    "recommendations",
    "recommended_profile_id",
    "beginner_commands",
    "advisory",
    "findings",
    "missing_requirements"
  ],
  "properties": {
    "schema_version": {
      "const": 6
    },
    "schema_uri": {
      "const": "https://rsasaki0109.github.io/lidar_slam_ros2/schemas/preflight-v6.schema.json"
    },
    "summary": {
      "type": "object",
      "required": [
        "bag_path",
        "topics",
        "capabilities",
        "pointcloud_inspection",
        "timestamp_order",
        "odometry_tf",
        "odometry_tf_timing"
      ],
      "properties": {
        "pointcloud_inspection": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "topic",
            "fields",
            "rko_lio_compatible",
            "timestamp_field",
            "reason"
          ],
          "properties": {
            "status": {
              "enum": [
                "not_applicable",
                "unavailable",
                "error",
                "empty",
                "inspected"
              ]
            },
            "topic": {
              "type": [
                "string",
                "null"
              ]
            },
            "frame_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "fields": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "datatype",
                  "count"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "datatype": {
                    "type": "integer"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            },
            "rko_lio_compatible": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "timestamp_field": {
              "type": [
                "string",
                "null"
              ]
            },
            "reason": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "timestamp_order": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "timestamp_source",
            "max_records_per_topic",
            "failed_topics",
            "topics",
            "reason"
          ],
          "properties": {
            "status": {
              "enum": [
                "not_applicable",
                "unavailable",
                "error",
                "failed",
                "sampled",
                "passed"
              ]
            },
            "timestamp_source": {
              "const": "header.stamp"
            },
            "max_records_per_topic": {
              "type": "integer",
              "minimum": 1
            },
            "failed_topics": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "topics": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "topic",
                  "msg_type",
                  "expected_records",
                  "records_scanned",
                  "complete",
                  "readable",
                  "first_stamp_ns",
                  "last_stamp_ns",
                  "reversal_count",
                  "invalid_stamp_count",
                  "max_backward_jump_ns"
                ],
                "properties": {
                  "topic": {
                    "type": "string",
                    "minLength": 1
                  },
                  "msg_type": {
                    "enum": [
                      "sensor_msgs/msg/PointCloud2",
                      "sensor_msgs/msg/Imu"
                    ]
                  },
                  "expected_records": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "records_scanned": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "complete": {
                    "type": "boolean"
                  },
                  "readable": {
                    "type": "boolean"
                  },
                  "first_stamp_ns": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "last_stamp_ns": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "reversal_count": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "invalid_stamp_count": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "max_backward_jump_ns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "frame_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "frame_ids": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                }
              }
            },
            "reason": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "odometry_tf": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "odometry_topic",
            "expected_records",
            "records_scanned",
            "complete",
            "readable",
            "header_frame_id",
            "child_frame_id",
            "frame_ids",
            "child_frame_ids",
            "invalid_frame_count",
            "tf_topics",
            "tf_records_scanned",
            "invalid_transform_count",
            "tf_path",
            "path_edges",
            "dynamic_path",
            "max_records_per_topic",
            "reason"
          ],
          "properties": {
            "status": {
              "enum": [
                "not_applicable",
                "unavailable",
                "error",
                "failed",
                "sampled",
                "passed"
              ]
            },
            "odometry_topic": {
              "type": [
                "string",
                "null"
              ]
            },
            "expected_records": {
              "type": "integer",
              "minimum": 0
            },
            "records_scanned": {
              "type": "integer",
              "minimum": 0
            },
            "complete": {
              "type": "boolean"
            },
            "readable": {
              "type": "boolean"
            },
            "header_frame_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "child_frame_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "frame_ids": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "child_frame_ids": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "invalid_frame_count": {
              "type": "integer",
              "minimum": 0
            },
            "tf_topics": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "topic",
                  "expected_records",
                  "records_scanned",
                  "complete",
                  "readable"
                ],
                "properties": {
                  "topic": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expected_records": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "records_scanned": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "complete": {
                    "type": "boolean"
                  },
                  "readable": {
                    "type": "boolean"
                  }
                }
              }
            },
            "tf_records_scanned": {
              "type": "integer",
              "minimum": 0
            },
            "invalid_transform_count": {
              "type": "integer",
              "minimum": 0
            },
            "tf_path": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "path_edges": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "from_frame",
                  "to_frame",
                  "dynamic"
                ],
                "properties": {
                  "from_frame": {
                    "type": "string",
                    "minLength": 1
                  },
                  "to_frame": {
                    "type": "string",
                    "minLength": 1
                  },
                  "dynamic": {
                    "type": "boolean"
                  }
                }
              }
            },
            "dynamic_path": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "max_records_per_topic": {
              "type": "integer",
              "minimum": 1
            },
            "reason": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "odometry_tf_timing": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "sample_basis",
            "pointcloud_topic",
            "expected_pointcloud_records",
            "pointcloud_records_scanned",
            "complete",
            "readable",
            "dynamic_path_edges",
            "tf_topics",
            "tf_records_scanned",
            "invalid_pointcloud_stamp_count",
            "invalid_transform_stamp_count",
            "clouds_before_all_dynamic_tf",
            "future_extrapolation_count",
            "first_future_cloud_stamp_ns",
            "max_future_gap_ns",
            "max_future_gap_edge",
            "latest_required_tf_stamp_ns_at_max_gap",
            "max_records_per_topic",
            "reason"
          ],
          "properties": {
            "status": {
              "enum": [
                "not_applicable",
                "unavailable",
                "error",
                "failed",
                "sampled",
                "passed"
              ]
            },
            "sample_basis": {
              "const": "bag_record_order_and_header_stamp"
            },
            "pointcloud_topic": {
              "type": [
                "string",
                "null"
              ]
            },
            "expected_pointcloud_records": {
              "type": "integer",
              "minimum": 0
            },
            "pointcloud_records_scanned": {
              "type": "integer",
              "minimum": 0
            },
            "complete": {
              "type": "boolean"
            },
            "readable": {
              "type": "boolean"
            },
            "dynamic_path_edges": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "from_frame",
                  "to_frame",
                  "dynamic"
                ],
                "properties": {
                  "from_frame": {
                    "type": "string",
                    "minLength": 1
                  },
                  "to_frame": {
                    "type": "string",
                    "minLength": 1
                  },
                  "dynamic": {
                    "const": true
                  }
                }
              }
            },
            "tf_topics": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "topic",
                  "expected_records",
                  "records_scanned",
                  "complete",
                  "readable"
                ],
                "properties": {
                  "topic": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expected_records": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "records_scanned": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "complete": {
                    "type": "boolean"
                  },
                  "readable": {
                    "type": "boolean"
                  }
                }
              }
            },
            "tf_records_scanned": {
              "type": "integer",
              "minimum": 0
            },
            "invalid_pointcloud_stamp_count": {
              "type": "integer",
              "minimum": 0
            },
            "invalid_transform_stamp_count": {
              "type": "integer",
              "minimum": 0
            },
            "clouds_before_all_dynamic_tf": {
              "type": "integer",
              "minimum": 0
            },
            "future_extrapolation_count": {
              "type": "integer",
              "minimum": 0
            },
            "first_future_cloud_stamp_ns": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "max_future_gap_ns": {
              "type": "integer",
              "minimum": 0
            },
            "max_future_gap_edge": {
              "anyOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "from_frame",
                    "to_frame",
                    "dynamic"
                  ],
                  "properties": {
                    "from_frame": {
                      "type": "string",
                      "minLength": 1
                    },
                    "to_frame": {
                      "type": "string",
                      "minLength": 1
                    },
                    "dynamic": {
                      "const": true
                    }
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "latest_required_tf_stamp_ns_at_max_gap": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "max_records_per_topic": {
              "type": "integer",
              "minimum": 1
            },
            "reason": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "recommendations": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "recommended_profile_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "beginner_commands": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "advisory": {
      "type": "array"
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message",
          "next_action"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "message": {
            "type": "string",
            "minLength": 1
          },
          "next_action": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "missing_requirements": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}
