{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnm-io/json-schema/arcnm-io-remnant-public-schema.json",
  "title": "RemnantPublic",
  "description": "Rectangular rests of one thickness and material in one environment's\nstock.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnm-io-remnants-api-openapi.yml#/components/schemas/RemnantPublic",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "env_id": {
      "type": "string",
      "format": "uuid",
      "title": "Env Id",
      "description": "The costing environment that holds it."
    },
    "length_mm": {
      "type": "number",
      "title": "Length Mm",
      "description": "Longer edge, in millimetres."
    },
    "width_mm": {
      "type": "number",
      "title": "Width Mm",
      "description": "Shorter edge, in millimetres."
    },
    "gauge_mm": {
      "type": "number",
      "title": "Gauge Mm",
      "description": "Thickness, in millimetres."
    },
    "material_grade_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Material Grade Id",
      "description": "The material grade; null when the remnant is stated for a whole material category."
    },
    "material_category": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Material Category",
      "description": "The material category."
    },
    "quantity": {
      "type": "integer",
      "title": "Quantity",
      "description": "Pieces of this size."
    },
    "status": {
      "type": "string",
      "enum": [
        "available",
        "reserved",
        "consumed",
        "scrapped"
      ],
      "title": "Status",
      "description": "`available`: in stock. `reserved`: held by a job nest while it runs. `consumed`: cut into parts by a job nest. `scrapped`: taken out of stock."
    },
    "origin_group_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Origin Group Id",
      "description": "The job nest group whose sheet left it; null for a remnant you stated."
    },
    "reserved_by_run_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reserved By Run Id",
      "description": "The job nest that holds or consumed it."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "consumed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Consumed At",
      "description": "When it left stock — consumed or scrapped."
    }
  },
  "type": "object",
  "required": [
    "id",
    "env_id",
    "length_mm",
    "width_mm",
    "gauge_mm",
    "material_grade_id",
    "material_category",
    "quantity",
    "status",
    "origin_group_id",
    "reserved_by_run_id",
    "created_at",
    "consumed_at"
  ]
}