{
  "lexicon": 1,
  "id": "space.polymodel.library.publishThing",
  "defs": {
    "main": {
      "type": "procedure",
      "description": "Publish a thing by creating part records first, model records second, and the thing record last on the authenticated actor's PDS, then eagerly projecting every successful record locally.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": [
            "thing"
          ],
          "properties": {
            "thing": {
              "type": "ref",
              "ref": "#thingInput"
            }
          }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": [
            "thing",
            "models"
          ],
          "properties": {
            "models": {
              "type": "array",
              "items": {
                "type": "ref",
                "ref": "#modelPublishResult"
              }
            },
            "thing": {
              "type": "ref",
              "ref": "#recordRef"
            }
          }
        }
      }
    },
    "modelInput": {
      "type": "object",
      "required": [
        "name",
        "parts"
      ],
      "properties": {
        "cover": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "space.polymodel.library.defs#image"
          },
          "maxLength": 8
        },
        "derivedFrom": {
          "type": "ref",
          "ref": "com.atproto.repo.strongRef"
        },
        "instructions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxLength": 100
        },
        "intendedToWorkWith": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "com.atproto.repo.strongRef"
          },
          "maxLength": 32
        },
        "license": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "maxLength": 256,
          "maxGraphemes": 64
        },
        "parts": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "#partInput"
          },
          "maxLength": 1024
        },
        "previews": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "space.polymodel.library.defs#image"
          },
          "maxLength": 12
        },
        "summary": {
          "type": "string",
          "maxLength": 2000,
          "maxGraphemes": 300
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 64,
            "maxGraphemes": 32
          },
          "maxLength": 16
        }
      }
    },
    "modelPublishResult": {
      "type": "object",
      "required": [
        "model",
        "parts"
      ],
      "properties": {
        "model": {
          "type": "ref",
          "ref": "#recordRef"
        },
        "parts": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "#recordRef"
          }
        }
      }
    },
    "partInput": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "derivedFrom": {
          "type": "ref",
          "ref": "com.atproto.repo.strongRef"
        },
        "dimensions": {
          "type": "ref",
          "ref": "space.polymodel.library.defs#bbox"
        },
        "file": {
          "type": "ref",
          "ref": "space.polymodel.library.defs#file"
        },
        "format": {
          "type": "string"
        },
        "intendedToWorkWith": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "com.atproto.repo.strongRef"
          },
          "maxLength": 32
        },
        "name": {
          "type": "string",
          "maxLength": 256,
          "maxGraphemes": 64
        },
        "notes": {
          "type": "string",
          "maxLength": 2000,
          "maxGraphemes": 300
        },
        "previews": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "space.polymodel.library.defs#image"
          },
          "maxLength": 12
        },
        "printSettings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxLength": 50
        },
        "units": {
          "type": "string"
        },
        "uploadId": {
          "type": "string"
        }
      }
    },
    "recordRef": {
      "type": "object",
      "required": [
        "uri",
        "cid"
      ],
      "properties": {
        "cid": {
          "type": "string",
          "format": "cid"
        },
        "uri": {
          "type": "string",
          "format": "at-uri"
        }
      }
    },
    "thingInput": {
      "type": "object",
      "required": [
        "name",
        "license",
        "models"
      ],
      "properties": {
        "cover": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "space.polymodel.library.defs#image"
          },
          "maxLength": 8
        },
        "derivedFrom": {
          "type": "ref",
          "ref": "com.atproto.repo.strongRef"
        },
        "instructions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxLength": 100
        },
        "intendedToWorkWith": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "com.atproto.repo.strongRef"
          },
          "maxLength": 32
        },
        "license": {
          "type": "string"
        },
        "models": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "#modelInput"
          },
          "maxLength": 256
        },
        "name": {
          "type": "string",
          "maxLength": 256,
          "maxGraphemes": 64
        },
        "previews": {
          "type": "array",
          "items": {
            "type": "ref",
            "ref": "space.polymodel.library.defs#image"
          },
          "maxLength": 12
        },
        "summary": {
          "type": "string",
          "maxLength": 2000,
          "maxGraphemes": 300
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 64,
            "maxGraphemes": 32
          },
          "maxLength": 16
        }
      }
    }
  }
}