{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-org-material-grade-update-schema.json",
  "title": "OrgMaterialGradeUpdate",
  "description": "Partial update for an org-private grade. ``designation`` and\n``category`` are immutable — both are baked into the URN, and the URN\nis the stable cross-system identifier.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnm-io-materials-api-openapi.yml#/components/schemas/OrgMaterialGradeUpdate",
  "properties": {
    "name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Name",
      "description": "Human-readable name of the material."
    },
    "iso_machining_group": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoMachiningGroup"
        },
        {
          "type": "null"
        }
      ],
      "description": "ISO 513 machining group (P/M/K/N/S/H)."
    },
    "workpiece_group_code": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 16
        },
        {
          "type": "null"
        }
      ],
      "title": "Workpiece Group Code",
      "description": "Leaf of the workpiece material tree the grade machines as (see `GET /materials/workpiece-groups`); an empty string clears it so the grade prices on its category's default cutting data again."
    },
    "density_kg_per_m3": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 25000.0,
          "minimum": 100.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Density Kg Per M3",
      "description": "Material density in kilograms per cubic metre. Mind the unit: a value in g/cm³ is 1000x too small and is rejected."
    },
    "is_active": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Is Active",
      "description": "Set false to retire the grade from pickers without deleting history."
    },
    "attributes": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Attributes",
      "description": "The material statement for this grade: mechanical and physical figures (`yield_mpa`, `tensile_mpa`, `hardness_hb`, …) and the categorical route gates (`laser_cuttable`, `weldability_class`, `heat_treatable`, …). A closed vocabulary, not free-form: an unknown key or a verdict outside a gate's set is refused (422) rather than stored, because a key nothing reads and a misspelled one are indistinguishable on the quote. `GET /materials/attribute-vocabulary` lists every accepted key, its unit or its verdicts, and what the costing engine does with it."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "$defs": {
    "IsoMachiningGroup": {
      "type": "string",
      "enum": [
        "P",
        "M",
        "K",
        "N",
        "S",
        "H"
      ],
      "title": "IsoMachiningGroup",
      "description": "ISO 513 workpiece groups — drives cutting-data lookup and tariffs.\n\n* ``P`` — non-alloyed & low-alloyed steels\n* ``M`` — stainless steels (austenitic, duplex, …)\n* ``K`` — cast iron (grey, nodular, malleable)\n* ``N`` — non-ferrous (aluminium, copper, plastics)\n* ``S`` — heat-resistant super-alloys + titanium\n* ``H`` — hardened steels (45–65 HRC)"
    }
  }
}