{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.directmotion.com/data/request.schema.json",
  "title": "Request to Direct Motion",
  "_about": "JSON Schema for a request an AI agent (or a person) sends to Direct Motion. Leave out what you do not know; never invent values. consent_to_contact must be true.",
  "type": "object",
  "required": ["request_type", "on_behalf_of"],
  "properties": {
    "request_type": { "enum": ["new_machine", "retrofit", "4c", "support", "partner", "other"] },
    "application": { "enum": ["machine_tool", "factory_automation", "robot", "test_rig", "spindle_or_pump", "other"] },
    "on_behalf_of": {
      "type": "object",
      "required": ["name", "email", "consent_to_contact"],
      "properties": {
        "name": { "type": "string" },
        "email": { "type": "string", "format": "email" },
        "company": { "type": "string" },
        "country": { "type": "string" },
        "consent_to_contact": { "const": true, "description": "The human agreed that DM may contact them." }
      }
    },
    "machine": {
      "type": "object",
      "properties": {
        "description": { "type": "string" },
        "axes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "motor": { "type": "string" },
              "encoder": { "enum": ["BiSS-C", "BiSS", "sin/cos", "incremental", "none", "unknown"] },
              "rated_current_a_rms": { "type": "number" },
              "peak_current_a_rms": { "type": "number" },
              "travel": { "type": "string" },
              "max_speed": { "type": "string" },
              "load": { "type": "string" }
            }
          }
        },
        "spindles": {
          "type": "array",
          "items": { "type": "object", "properties": { "motor": { "type": "string" }, "power_kw": { "type": "number" }, "max_rpm": { "type": "number" } } }
        },
        "io": { "type": "object", "properties": { "inputs": { "type": "integer" }, "outputs": { "type": "integer" }, "handwheel": { "type": "boolean" } } },
        "supply": { "type": "string" }
      }
    },
    "software": {
      "type": "object",
      "properties": {
        "who_writes_it": { "type": "string" },
        "needs": { "type": "string" },
        "depends_on": { "type": "array", "items": { "type": "string" }, "description": "rows from the applications table marked 'ask DM'" }
      }
    },
    "timeline": { "type": "string" },
    "quantity": { "type": "string" },
    "questions": { "type": "array", "items": { "type": "string" } },
    "agent": {
      "type": "object",
      "properties": { "name": { "type": "string" }, "draft_available": { "type": "boolean" } }
    }
  }
}
