{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-org-material-grade-create-schema.json",
  "title": "OrgMaterialGradeCreate",
  "description": "Details of the material grade to register for your organization.",
  "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/OrgMaterialGradeCreate",
  "properties": {
    "category": {
      "$ref": "#/$defs/MaterialCategory",
      "description": "Broad material family the grade belongs to (e.g. carbon_steel, aluminium)."
    },
    "designation": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Designation",
      "description": "Your designation for the grade (e.g. 'WS-42-Blank'). Letters, digits, dots and hyphens; rendered as entered, stored URN-safe. Must not collide with a catalogue code."
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "minLength": 1,
      "title": "Name",
      "description": "Human-readable name of the material."
    },
    "iso_machining_group": {
      "$ref": "#/$defs/IsoMachiningGroup",
      "description": "ISO 513 machining group (P/M/K/N/S/H). Shown on the grade; the cutting data itself comes from `workpiece_group_code` when set, and from the category's default bin otherwise."
    },
    "workpiece_group_code": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 16
        },
        {
          "type": "null"
        }
      ],
      "title": "Workpiece Group Code",
      "description": "Leaf of the workpiece material tree this grade machines as — `P2.2` for a hardened-and-tempered low-alloy steel, `M3.1` for a duplex stainless, `N1.2` for an age-hardened aluminium. Pick it from `GET /materials/workpiece-groups`. This is what selects the grade's cutting speeds and forces; leave it unset to price on the category's default cutting data."
    },
    "density_kg_per_m3": {
      "type": "number",
      "maximum": 25000.0,
      "minimum": 100.0,
      "title": "Density Kg Per M3",
      "description": "Material density in kilograms per cubic metre — steel is about 7850, aluminium about 2700. Mind the unit: a value in g/cm³ is 1000x too small and is rejected."
    },
    "attributes": {
      "additionalProperties": true,
      "type": "object",
      "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",
  "required": [
    "category",
    "designation",
    "name",
    "iso_machining_group",
    "density_kg_per_m3"
  ],
  "$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)"
    },
    "MaterialCategory": {
      "type": "string",
      "enum": [
        "carbon_steel",
        "alloy_steel",
        "stainless_steel",
        "tool_steel",
        "cast_iron",
        "aluminium",
        "copper_alloy",
        "nickel_alloy",
        "titanium_alloy",
        "magnesium_alloy",
        "zinc_alloy",
        "thermoplastic",
        "thermoset",
        "elastomer",
        "composite",
        "other"
      ],
      "title": "MaterialCategory",
      "description": "Top-level material family. Drives ISO machining group defaults and\nUI filtering. Values are stable identifiers — adding a new category is\nadditive; renaming is a breaking change."
    }
  }
}