{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/kontaktio/main/json-schema/kontaktio-stitching-pair-schema.json",
  "title": "StitchingPair",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kontaktio-device-portal-beam-api-openapi.yml#/components/schemas/StitchingPair",
  "type": "object",
  "required": [
    "firstDevice",
    "secondDevice"
  ],
  "properties": {
    "firstDevice": {
      "$ref": "#/$defs/StitchedDevice"
    },
    "secondDevice": {
      "$ref": "#/$defs/StitchedDevice"
    }
  },
  "$defs": {
    "StitchedDevice": {
      "type": "object",
      "required": [
        "uniqueId",
        "image",
        "pose"
      ],
      "properties": {
        "uniqueId": {
          "type": "string",
          "description": "Unique identifier of a beam/device."
        },
        "image": {
          "$ref": "#/$defs/StitchingImage"
        },
        "pose": {
          "$ref": "#/$defs/StitchingPose"
        }
      }
    },
    "StitchingImage": {
      "type": "object",
      "required": [
        "captured",
        "original",
        "corrected"
      ],
      "properties": {
        "captured": {
          "type": "string",
          "format": "date-time"
        },
        "original": {
          "type": "string",
          "format": "byte",
          "description": "Base64-encoded image bytes (no data URL prefix)."
        },
        "corrected": {
          "type": "string",
          "format": "byte",
          "description": "Base64-encoded image bytes (no data URL prefix)."
        }
      }
    },
    "StitchingPivotLocal": {
      "description": "Pivot (rotation point) of the image in the device image's local coordinates.",
      "type": "object",
      "required": [
        "x",
        "y"
      ],
      "properties": {
        "x": {
          "description": "X coordinate in local coordinates, between 0 and 1. Where 0 is leftmost and 1 is rightmost.",
          "type": "number",
          "format": "decimal",
          "minimum": 0,
          "maximum": 1
        },
        "y": {
          "description": "Y coordinate in local coordinates, between 0 and 1. Where 0 is top and 1 is bottom.",
          "type": "number",
          "format": "decimal",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "StitchingPivotWorld": {
      "description": "Pivot (rotation point) of the image in the world coordinates that are shared between stitched devices.\nOrigin is top left corner.",
      "type": "object",
      "required": [
        "x",
        "y"
      ],
      "properties": {
        "x": {
          "description": "X coordinate in world coordinates.",
          "type": "integer"
        },
        "y": {
          "description": "Y coordinate in world coordinates.",
          "type": "integer"
        }
      }
    },
    "StitchingPose": {
      "type": "object",
      "required": [
        "pivotLocal",
        "pivotWorld",
        "rotationDeg"
      ],
      "properties": {
        "pivotLocal": {
          "$ref": "#/$defs/StitchingPivotLocal"
        },
        "pivotWorld": {
          "$ref": "#/$defs/StitchingPivotWorld"
        },
        "rotationDeg": {
          "type": "number",
          "format": "decimal",
          "description": "Clockwise rotation in degrees around pivot point."
        }
      }
    }
  }
}