{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://rsasaki0109.github.io/lidar_slam_ros2/schemas/map-edit-plan-v1.schema.json",
  "title": "lidar_slam map edit plan v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "source",
    "operations"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "map_bundle_sha256",
        "full_map_sha256",
        "pointcloud_map_sha256",
        "loop_edges_sha256"
      ],
      "properties": {
        "map_bundle_sha256": {
          "$ref": "#/definitions/sha256"
        },
        "full_map_sha256": {
          "$ref": "#/definitions/sha256"
        },
        "pointcloud_map_sha256": {
          "$ref": "#/definitions/sha256"
        },
        "loop_edges_sha256": {
          "$ref": "#/definitions/sha256"
        }
      }
    },
    "operations": {
      "type": "array",
      "minItems": 1,
      "items": {
        "oneOf": [
          {
            "$ref": "#/definitions/remove_box"
          },
          {
            "$ref": "#/definitions/disable_loop_edge"
          }
        ]
      }
    }
  },
  "definitions": {
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "xyz": {
      "type": "array",
      "items": [
        {"type": "number"},
        {"type": "number"},
        {"type": "number"}
      ],
      "minItems": 3,
      "maxItems": 3,
      "additionalItems": false
    },
    "operation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
    },
    "remove_box": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "type", "min_xyz", "max_xyz"],
      "properties": {
        "id": {"$ref": "#/definitions/operation_id"},
        "type": {"const": "remove_box"},
        "min_xyz": {"$ref": "#/definitions/xyz"},
        "max_xyz": {"$ref": "#/definitions/xyz"}
      }
    },
    "disable_loop_edge": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "type", "from", "to"],
      "properties": {
        "id": {"$ref": "#/definitions/operation_id"},
        "type": {"const": "disable_loop_edge"},
        "from": {"type": "integer", "minimum": 0},
        "to": {"type": "integer", "minimum": 0}
      }
    }
  }
}
