{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-cutting-tool-create-schema.json",
  "title": "CuttingToolCreate",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnm-io-tools-api-openapi.yml#/components/schemas/CuttingToolCreate",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 255,
      "minLength": 1,
      "title": "Name",
      "description": "Human-readable name of the tool."
    },
    "kind": {
      "$ref": "#/$defs/ToolKind",
      "description": "Tool kind (VDI 2852 class), e.g. end_mill or drill."
    },
    "diameter_mm": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1000.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Diameter Mm",
      "description": "Cutting diameter, in millimetres (null for turning inserts)."
    },
    "teeth": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 400.0,
          "minimum": 1.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Teeth",
      "description": "Number of cutting edges / flutes / blade teeth."
    },
    "cutting_material": {
      "type": "string",
      "title": "Cutting Material",
      "description": "Cutting-material class (HSS, carbide, coated carbide, ...).",
      "default": "carbide"
    },
    "coating": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Coating",
      "description": "Coating designation (e.g. TiAlN), if any."
    },
    "vendor": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ],
      "title": "Vendor",
      "description": "Tool manufacturer / vendor."
    },
    "item_no": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ],
      "title": "Item No",
      "description": "Vendor item / order number."
    },
    "price_eur": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1000000.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Price Eur",
      "description": "Replacement price, in EUR."
    },
    "tool_life_min": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 100000.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Life Min",
      "description": "Expected tool life in cutting minutes (per edge set)."
    },
    "notes": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ],
      "title": "Notes",
      "description": "Free-form shop notes."
    },
    "spec": {
      "additionalProperties": true,
      "type": "object",
      "title": "Spec",
      "description": "Kind-specific properties — e.g. a press-brake die's V opening and load rating, a saw blade's kerf and pitch, a plasma consumable set's amperage. Validated per kind; empty for rotating cutters, whose geometry uses the fields above."
    },
    "parameters": {
      "items": {
        "$ref": "#/$defs/CuttingToolParameterWrite"
      },
      "type": "array",
      "maxItems": 64,
      "title": "Parameters",
      "description": "Optional cutting-data rows to create with the tool — one row per parameter, keyed (material, operation, size, quality). Cutting data is written in the app only: a request through the MCP / agent surface that sends rows here is refused (422) — create the tool without them."
    },
    "attach_to_environment_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Attach To Environment Ids",
      "description": "Costing environments the new tool joins (D7 — membership is always explicit). Omit for the documented default: every current environment of your organization. Send [] to attach nowhere (the tool exists in the crib but prices nothing until attached)."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "kind"
  ],
  "$defs": {
    "CuttingToolParameterWrite": {
      "properties": {
        "material_code": {
          "type": "string",
          "maxLength": 64,
          "title": "Material Code",
          "description": "Material group or workpiece-group code the value applies to (e.g. steel_C45 or P2.2)."
        },
        "operation": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Operation",
          "description": "Operation this value is stated for (e.g. drill, face_mill); null = every operation this tool can do — a real semantic, not a sentinel."
        },
        "size_mm": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Size Mm",
          "description": "Size axis (sheet thickness, bar size); resolution takes the nearest row, and a null-size row applies at every size."
        },
        "quality": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 16
            },
            {
              "type": "null"
            }
          ],
          "title": "Quality",
          "description": "'production' | 'quality'; null = unspecified."
        },
        "parameter": {
          "type": "string",
          "maxLength": 32,
          "title": "Parameter",
          "description": "Parameter key in the resolver's own vocabulary (V_c, f_z, …)."
        },
        "value": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "title": "Value",
          "description": "The stated (start) value."
        },
        "value_min": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Value Min",
          "description": "Lower bound of the published window."
        },
        "value_max": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Value Max",
          "description": "Upper bound of the published window."
        },
        "source": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255
            },
            {
              "type": "null"
            }
          ],
          "title": "Source",
          "description": "Where the value comes from (catalogue sheet, trial, ...)."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "material_code",
        "parameter",
        "value"
      ],
      "title": "CuttingToolParameterWrite",
      "description": "Write shape — non-finite values rejected before plausibility checks."
    },
    "ToolKind": {
      "type": "string",
      "enum": [
        "end_mill",
        "face_mill",
        "drill",
        "spot_drill",
        "centre_drill",
        "tap",
        "reamer",
        "boring_bar",
        "thread_mill",
        "insert_holder_turn",
        "grooving_tool",
        "grinding_wheel",
        "chamfer_mill",
        "countersink",
        "counterbore",
        "saw_blade",
        "edm_wire",
        "press_brake_punch",
        "press_brake_die",
        "tube_bend_die",
        "plasma_consumable_set",
        "laser_nozzle",
        "waterjet_nozzle",
        "punch_die_set",
        "weld_consumable",
        "broach"
      ],
      "title": "ToolKind"
    }
  }
}