{
  "lexicon": 1,
  "id": "space.polymodel.library.updateThing",
  "defs": {
    "main": {
      "type": "procedure",
      "description": "Update an owned thing composition with updated thing/model/part data. Existing model/part inputs with uri are updated in place; inputs without uri create new records. Removed child records are detached from the updated parent records but not deleted, so they can be restored later.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["uri", "thing"],
          "properties": {
            "uri": { "type": "string", "format": "at-uri" },
            "thing": { "type": "ref", "ref": "#thingInput" }
          }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["thing", "models"],
          "properties": {
            "thing": { "type": "ref", "ref": "space.polymodel.library.publishThing#recordRef" },
            "models": { "type": "array", "items": { "type": "ref", "ref": "space.polymodel.library.publishThing#modelPublishResult" } }
          }
        }
      }
    },
    "partInput": {
      "type": "object",
      "required": ["name"],
      "properties": {
        "uri": { "type": "string", "format": "at-uri" },
        "name": { "type": "string", "maxGraphemes": 64, "maxLength": 256 },
        "file": { "type": "ref", "ref": "space.polymodel.library.defs#file" },
        "uploadId": { "type": "string" },
        "format": { "type": "string" },
        "dimensions": { "type": "ref", "ref": "space.polymodel.library.defs#bbox" },
        "units": { "type": "string" },
        "notes": { "type": "string", "maxGraphemes": 300, "maxLength": 2000 },
        "printSettings": { "type": "array", "items": { "type": "string" }, "maxLength": 50 },
        "previews": { "type": "array", "items": { "type": "ref", "ref": "space.polymodel.library.defs#image" }, "maxLength": 12 },
        "derivedFrom": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
        "intendedToWorkWith": { "type": "array", "items": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, "maxLength": 32 }
      }
    },
    "modelInput": {
      "type": "object",
      "required": ["name", "parts"],
      "properties": {
        "uri": { "type": "string", "format": "at-uri" },
        "name": { "type": "string", "maxGraphemes": 64, "maxLength": 256 },
        "summary": { "type": "string", "maxGraphemes": 300, "maxLength": 2000 },
        "instructions": { "type": "array", "items": { "type": "string" }, "maxLength": 100 },
        "license": { "type": "string" },
        "tags": { "type": "array", "items": { "type": "string", "maxGraphemes": 32, "maxLength": 64 }, "maxLength": 16 },
        "cover": { "type": "array", "items": { "type": "ref", "ref": "space.polymodel.library.defs#image" }, "maxLength": 8 },
        "previews": { "type": "array", "items": { "type": "ref", "ref": "space.polymodel.library.defs#image" }, "maxLength": 12 },
        "parts": { "type": "array", "items": { "type": "ref", "ref": "#partInput" }, "maxLength": 1024 },
        "derivedFrom": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
        "intendedToWorkWith": { "type": "array", "items": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, "maxLength": 32 }
      }
    },
    "thingInput": {
      "type": "object",
      "required": ["name", "license", "models"],
      "properties": {
        "name": { "type": "string", "maxGraphemes": 64, "maxLength": 256 },
        "summary": { "type": "string", "maxGraphemes": 300, "maxLength": 2000 },
        "instructions": { "type": "array", "items": { "type": "string" }, "maxLength": 100 },
        "license": { "type": "string" },
        "tags": { "type": "array", "items": { "type": "string", "maxGraphemes": 32, "maxLength": 64 }, "maxLength": 16 },
        "cover": { "type": "array", "items": { "type": "ref", "ref": "space.polymodel.library.defs#image" }, "maxLength": 8 },
        "previews": { "type": "array", "items": { "type": "ref", "ref": "space.polymodel.library.defs#image" }, "maxLength": 12 },
        "models": { "type": "array", "items": { "type": "ref", "ref": "#modelInput" }, "maxLength": 256 },
        "derivedFrom": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
        "intendedToWorkWith": { "type": "array", "items": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, "maxLength": 32 }
      }
    }
  }
}
